Vehicle Model

Chris S.

12-11-2007 17:01:03

I just want to make a simple model for a vehicle: a box that moves.

The current model I'm trying is a box set on four spheres (aka wheels). The spheres are anchored using hinge joints and there is no contact between the geometries (no collisions). At first, I encapsulated everything in transform geometries created in a separate space from the default a la the walking character on the wiki. But, the geometries act REALLY funny like this. After a collision, the spheres and the box go in strange directions completely out of relation with the joints or the physics rules I set up, and any force applied causes the box to blow away like a leaf in the wind--literally, it spins and floats around an imaginary center; it would make for excellent particle physics. At one point I tweaked it so everything acted almost correctly, with spinning wheels and all, but there was still that ... funniness.

So I threw out the separate space and created everything in the default space. Now everything holds together correctly, but the joints are rigid too. The vehicle rests, but any force applied doesn't produce an action, like there's too much friction. Come to think of it, maybe hinge joints are not quite right, but I figure if I can at least get some motion in the right direction, I can go from there. Zero motion is harder to interpret, so I just don't know what's going wrong.

So, I just want to stick with the box/sphere model, and get it so that I just need to apply a forward force on the body, like pushing a toy car. I can attach code if needed, but I want some insight into this approach first. Does anyone have any help to offer me?

Aquatix

12-11-2007 17:22:03

Have you seen OgreOde::Prefabs? There is an example (and a good one) of a model, very similar to what you are describing. Check out their source code, play with the demos, hopefully that's all you need!
BTW, as you'll advance further, you might want to improve the existing prefab model, for instance by using the new types of constraints.

Chris S.

12-11-2007 19:05:33

Hah. That's funny you said that. I had just gone back and taken a look at the car demo in SimpleScenes, and it looks quite similar to what I have. It's a bit overcomplicated for what I'm doing, so I'll pick apart the implementation. That'll do it, though. Thanks.

How might I add constraints? With joints? If so, can I use joints on bodies without any geometry or mass? Say I just want two bodies connected, but I want a more complex joint than provided, could I use a set of joints connected with, say, dummy bodies in between?