A few physics questions

n1000

06-02-2007 15:42:43

I am new to physics and I have a few questions about nxOgre.

1) If I want to resize/scale the collision mesh, how is this done. When i use the mesh itself for the collision mesh, and then set the scale for the SceneNode larger than (1,1,1), the collision mesh is still using the (1,1,1) scale. How is this done?

2) What type of joint would I use for a wheel on a car?

3) How does one go about figuring out "where" on the car to attach the wheel? Are there any general techniques people use?

4) If I had a car and I wanted it to be able to climb stairs, does anyone have any tips on how I might accomplish this? Would I make the wheels very "sticky" so they would grip the stairs and pull the car body up? I really don't have any idea how to approach this and make it look just like the car is gripping each individual stair, pulling itself up by the front wheels, and then repeating until it gets to the top of the entire staircase.

Thanks again for the excellent NxOgre.

Grom

07-02-2007 15:36:13

You should set the size of the collision mesh when you create it, and then scale the entity associated with it appropriately. If you want to scale a meshShape, I think you're going to need to literally resize the mesh (loop through the vertices and make a new mesh) before creating the body.

I haven't done much with wheels myself, but I would look at betajaen's code and see what joints he uses. As far as where to attach the wheel, I personally would put together some kind of editor so I could create vehicles of all sizes/shapes.

As far as driving a car up a flight of steps, I think you could do a call to addForceAtPos from below the front of the vehicle. It might not look like you want it to though.

betajaen

07-02-2007 16:14:47

A hinge or motorJoint for the wheels, and for the going up the stairs bit. As Ozwaldo said, add some force or increase the traction (friction) or size of the wheels. You also cheat and have the visual mesh look like steps but the collision mesh is a slope. They do this in Grand Theft Auto and it works quite well.