Benton Posted April 14, 2012 Share Posted April 14, 2012 Hey guys, I am adding my car models into my racing game in place of the scout model that comes with LE. However, my model viewer crashes every time I try to view that scout model so I can't see how it is structured. How each part of the model is named, etc. Could someone help me set up my car model? Thanks, Benton Edit: The error I get when I change the chassis model to my chassis is: chassis=LoadModel("abstract::muscleblack.gmf") carobject=objecttable[chassis] car=carobject.vehicle Error: Attempt to index global 'carobject' a nil value... Quote Windows 7 Professional 64 bit, 16 gigs ram, 3.30GHz Quad Core, GeForce GTX 460 one gig, Leadwerks 2.5, Blender 2.62, Photoshop CS3, UU3D Link to comment Share on other sites More sharing options...
DigitalHax Posted April 14, 2012 Share Posted April 14, 2012 In case you havent seen it, check this out about vehicles - http://bit.ly/Hzlcm6 Quote Win7 64bit, Leadwerks SDK 2.5, Visual Studio 2012, 3DWS, 3ds Max, Photoshop CS5. Life is too short to remove USB safely. Link to comment Share on other sites More sharing options...
Daimour Posted April 15, 2012 Share Posted April 15, 2012 Error: Attempt to index global 'carobject' a nil value... Try to add a simple lua-script for your model (muscleblack.lua) with code: require("scripts/class") local class=CreateClass(...) It will register your model in table "objecttable", if you want so. Quote Link to comment Share on other sites More sharing options...
Benton Posted April 15, 2012 Author Share Posted April 15, 2012 Thanks! Did not know that you needed that for objecttable... Quote Windows 7 Professional 64 bit, 16 gigs ram, 3.30GHz Quad Core, GeForce GTX 460 one gig, Leadwerks 2.5, Blender 2.62, Photoshop CS3, UU3D Link to comment Share on other sites More sharing options...
Benton Posted April 17, 2012 Author Share Posted April 17, 2012 Ok so I need to set up a car from scratch. Can I use some of the scripts that are already written, or do I need to totally write some new code? Quote Windows 7 Professional 64 bit, 16 gigs ram, 3.30GHz Quad Core, GeForce GTX 460 one gig, Leadwerks 2.5, Blender 2.62, Photoshop CS3, UU3D Link to comment Share on other sites More sharing options...
Pixel Perfect Posted April 17, 2012 Share Posted April 17, 2012 If I were you I'd learn as much as I can from the existing setup scripts but to be honest, if you really want to understand the mechanics of setting up a car, just experiment as much as you can with all the variables and possibilities until you really understand how each function affects the car physics. Code and test and observe, alter code and retest and observe. That sort of understanding (i.e NO SHORTCUTS) will give you a solid foundation to move forwards on and will inevitably produce a better end result. Yes its going to take some time but it will always be worth it in the long run. 1 Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
Road Kill Kenny Posted April 17, 2012 Share Posted April 17, 2012 Yeh you need a solid understanding on the LE vehicle setup. I wouldn't recommend making your own from scratch at least not at this point. Once you have the standard LE vehicle down and you're happy with it, start experimenting with adding artificial external forces. I would recommend: 1. Determine the major 'real forces' that happen on cars in real life, (i.e. drag(most important), momentum, friction etc. etc.) 2. Decide which ones are the most important. 3. Calculate approximations of these forces (or rather make ur code approximately calculate these values). I can't stress enough how you must not try to get exact figures.. You will only get frustrated with that and 99.999% of players won't know the difference between a slight approximation and a perfect calculation of a force. The external forces are rather tough to get right I found, so prepare to play around with them a lot. Oh one more step 4. Determine when the forces are applied and how you want to trigger them in game. For example I made my car loose traction when a function of its speed and turn angle was greater than a fixed amount. Good luck. Quote STS - Scarlet Thread Studios AKA: Engineer Ken Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now! Link to comment Share on other sites More sharing options...
Digiverse Posted April 17, 2012 Share Posted April 17, 2012 For example I made my car loose traction when a function of its speed and turn angle was greater than a fixed amount. I'd love to know what functions you used to achieve this effect. I can work out the speed and turn angles easily enough, but I dont know how to physically change the traction. SetBodyFriction doesn't seem to have any effect for me, is that what you are using? I got some quite interesting effects using SetBodyOmega by forcing oversteer in similar circumstances. It needs a lot of tweaking and I just wonder how others are achieving the effects of low grip and oversteer in their games. Quote Link to comment Share on other sites More sharing options...
Road Kill Kenny Posted April 17, 2012 Share Posted April 17, 2012 I'd love to know what functions you used to achieve this effect. I can work out the speed and turn angles easily enough, but I dont know how to physically change the traction. SetBodyFriction doesn't seem to have any effect for me, is that what you are using? I got some quite interesting effects using SetBodyOmega by forcing oversteer in similar circumstances. It needs a lot of tweaking and I just wonder how others are achieving the effects of low grip and oversteer in their games. It sure is a tricky one and there is no function to simply reduce traction. You have to make it yourself by applying the correct forces to the vehicle to fake momentum and also to stop the tyres turning. Its pretty difficult to get right. But yeh no single function will fix it Quote STS - Scarlet Thread Studios AKA: Engineer Ken Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now! Link to comment Share on other sites More sharing options...
Benton Posted April 17, 2012 Author Share Posted April 17, 2012 Yeh you need a solid understanding on the LE vehicle setup. I wouldn't recommend making your own from scratch at least not at this point. Once you have the standard LE vehicle down and you're happy with it, start experimenting with adding artificial external forces. The problem I am having is not getting really realistic physics, but getting "the standard LE vehicle" working on my car model. But I don't understand why it is not working. For instance: chassis=LoadModel("abstract::monstertruck.gmf") carobject=objecttable[chassis] car=carobject.vehicle error: Attempt to index global carobject a nil value... I can't find any docs for objecttable[chassis] I just want to get the standard LE vehicle setup working for my model, thats it... Quote Windows 7 Professional 64 bit, 16 gigs ram, 3.30GHz Quad Core, GeForce GTX 460 one gig, Leadwerks 2.5, Blender 2.62, Photoshop CS3, UU3D Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.