Physics model for racing game like Wipeout, F-Zero, etc.

zissakos

11-06-2008 10:38:08

Hi guys,

i finally managed to get NxOgre (1.0-21) to work (with Physx 2.8.1 and Ogre 1.4.8). I tried a vehicle (Box Shape) with a wheelset attached on a racetrack (TriangleMesh). Everything works fine, although it still needs a little tweaking.

Now I have some general questions regarding the physics model to use in my game:
Which is the best physics model to use if I want to make a science-fiction-style racing game like Wipeout or F-Zero etc (cars with no wheels hovering about 1m above the ground)?

1. Using all the Wheelset stuff but with invisible wheels? Are invisible wheels possible actually?
(This would give me the hovering effect for free)
2. Applying forces on the Car Body directly? If so:
2a. Which forces and how?
2b. How would you get the hovering effect (1m above the ground), since the physical representation of the car would be a triangle mesh for exact collision detection?
3. What about those CharacterControllers etc? Would that help me here?
4. Has anybody ever done that with NxOgre? How?
5. How would you do corkscrew tracks without the car falling to the ground (I use gravity since the racing takes place on various planets)?


Thank you in advance!

betajaen

11-06-2008 11:27:27

1. Yep
2a. addForce, and addTorque. If your using the wheels then you give torque to the wheels and not to the body.
2b. By not using the wheels and creating a force that counteracts the acceleration of gravity + 1 metre. This is all basic physics that can be found in text books. I recommend you do this rather than the wheels if you want to do a wipeout style game.
3. Nope; they represent humans.
4. I think somebody attempted doing this - including myself, I even made a level mesh.
5. The mesh was a corkscrew as well. If I remember correctly, I decided to turn off gravity (for the car bodys) and continuously ray cast downwards (relative to the vehicle) and if it hit something solid - I would get a normal (direction of the triangle) inverse it and apply gravity using the normal.

It's a complicated subject, but I started doing a game like this once. So it is possible and a prototype could easily made up in cake quite quickly.

zissakos

11-06-2008 12:02:06

Thanks for your reply betajaen!

I will try what you said.

Would you share the mesh? How did you create it actually? I am looking for a modeling tool that suits best for creating this kind of meshes. Just tried Blender but it seems so overcomplicated, although i have basic knowledge of it...

Also, would you share some code of your attempt or post some code snippets about how to disable gravity per body and the whole stuff mentioned in answer #5?

thank you!

betajaen

11-06-2008 12:12:58

I don't think I have the mesh or any code left. I didn't go far in to it, and it was a year or two back.

Disabling gravity per actor is very easy; you just raise a NX_BF_DISABLE_GRAVITY flag with the Actor's Body. As for custom gravity; I will let you figure it out; Raycasting is easy; getting the normal from the raycast is very easy; inverting it; then applying a force based on the normal. It's all how I described.

zissakos

12-06-2008 18:15:43

I dont't think turning off gravity is a good idea, because other than when being inside a corkscrew i would like to have gravity turned on for more realistic crashes etc. Besides, this approach wouldn't work with jumps, right?

I found something in the physx documentation: force fields. Couldn't I just a use very strong force fields that are directed towards the racetrack for the sgements that are upside down? Are they implemented in NxOgre?

betajaen

12-06-2008 18:28:56

Actually. Yes, that is a good idea and ForceFields are implemented.