Some practical questions about my first actual application.
Posted: Mon Aug 21, 2006 10:28 pm
So - I've played with the demo's and built enough infrastructure into my game that I can bring in objects of various kinds and apply impulses to them to kick them around. Boxes, cylinders and spheres bounce around convincingly - and I can replace them with real geometry for the graphics - so that a car can be a couple of cubes with some cylinders for wheels in the physics yet look like a nice shiney car in the graphics....Yeah! So far, so good!
So now I need to start wiring all of this into my game logic - and creating some 'real' objects. This brings me to some questions.
1) If I'm using 9.8m/s for gravity - lengths in meters, masses in kg, times in seconds - what units are things like friction, linear and rotational damping and such in? Are these 'real' units? Does anyone have a good online source of frictional coefficients for common materials? What damping forces am I considering anyway? Air resistance is negligable at the speeds I care about.
2) The first object I want to be able to drive around is a fork-lift truck (one of those should be a lot of fun in a room full of packing crates and barrels!). For collision purposes, I can have the 'forks' be one 'BoxShape', the body of the forklift be another box and the wheels be little cylinders that I can use to drive and steer with. But if I do that, the center of gravity of the thing is about a meter off the ground - and any small collision makes it fall over. In reality, these things have huge weights built into them close to the ground to stop that from happening. So I clearly need to move the simulated center of gravity down much lower. How do I do that? Do I need to make the body out of two boxes - one very heavy one and one light one? (Perhaps, in this case, I can just make the wheels unreasonably heavy - but that's a kludge and I'm asking a general question here...I'll probably need to put a bunch of weight in the back of the forklift in order to prevent it tipping forwards when it lifts something too),
3) The steering wheels on my forklift need to be able to rotate freely in one axis - so that they roll nicely - and need to be driven actively in the other axis in response to my player's joystick movements - yet have no motion at all in the third axis. It's not clear what kind of constraint setup I need to make that happen - any clues? (Or better still, an example?)
4) I have a LOT of static geometry in the scene. Is it better to keep this in one giant triangle mesh - or to divide it up into a bunch of smaller mesh objects within one CompoundShape - or should I perhaps have a ton of tiny separate static objects. Where are the efficiencies to be had?
5) I've seen comments elsewhere that large triangles are a bad idea (and also very small ones) - somewhere I saw a lower limit of maybe 20cm - what kind of upper limit are we talking about here? There was also a comment that long, thin triangles would be bad. How long/thin is that?
Thanks in advance.
So now I need to start wiring all of this into my game logic - and creating some 'real' objects. This brings me to some questions.
1) If I'm using 9.8m/s for gravity - lengths in meters, masses in kg, times in seconds - what units are things like friction, linear and rotational damping and such in? Are these 'real' units? Does anyone have a good online source of frictional coefficients for common materials? What damping forces am I considering anyway? Air resistance is negligable at the speeds I care about.
2) The first object I want to be able to drive around is a fork-lift truck (one of those should be a lot of fun in a room full of packing crates and barrels!). For collision purposes, I can have the 'forks' be one 'BoxShape', the body of the forklift be another box and the wheels be little cylinders that I can use to drive and steer with. But if I do that, the center of gravity of the thing is about a meter off the ground - and any small collision makes it fall over. In reality, these things have huge weights built into them close to the ground to stop that from happening. So I clearly need to move the simulated center of gravity down much lower. How do I do that? Do I need to make the body out of two boxes - one very heavy one and one light one? (Perhaps, in this case, I can just make the wheels unreasonably heavy - but that's a kludge and I'm asking a general question here...I'll probably need to put a bunch of weight in the back of the forklift in order to prevent it tipping forwards when it lifts something too),
3) The steering wheels on my forklift need to be able to rotate freely in one axis - so that they roll nicely - and need to be driven actively in the other axis in response to my player's joystick movements - yet have no motion at all in the third axis. It's not clear what kind of constraint setup I need to make that happen - any clues? (Or better still, an example?)
4) I have a LOT of static geometry in the scene. Is it better to keep this in one giant triangle mesh - or to divide it up into a bunch of smaller mesh objects within one CompoundShape - or should I perhaps have a ton of tiny separate static objects. Where are the efficiencies to be had?
5) I've seen comments elsewhere that large triangles are a bad idea (and also very small ones) - somewhere I saw a lower limit of maybe 20cm - what kind of upper limit are we talking about here? There was also a comment that long, thin triangles would be bad. How long/thin is that?
Thanks in advance.