Game Development Community

Vehicle Physics

by Matt Huston · in Torque Game Engine · 11/10/2005 (6:08 am) · 13 replies

My game revolves around vehicles and I am wondering what I can do with them in terms of physics. My vehicles should have a realistic feel to them as opposed to Torques current system which feels very arcadey, as it probably should. What can I do to make my vehicles react as they should. Incorporating things like "real mass" into calculations. I am using the tank pack by the way too, that will be the basis for all of my vehicles.

Do I require one of those physics engines that are out there, ODE, PhysX, etc?

I am also a bit worried about collision detection. My game requires quite in depth collision detection for certain parts of the vehicle.

#1
11/10/2005 (6:31 am)
Yes, you will probably require a physics engine to get a more realistic response from your vehicles. Several people are working on incorporating ODE into Torque, also there are SDK's like Tokamak that can be interfaced with Torque. I'm going to try Tokamak, and if I have any success, I'll let you know.

As far as collision detection, there are several resources that work on that. This one is for players, but could be used for vehicles as well. It breaks up the collision mesh into as many as you need, so you can tell what part of your player/vehicle is hit.

BTW, your tanks look very nice.
#2
11/10/2005 (6:46 am)
Thanks, collision detection thing looks interesting, thanks for that.

Let me know if how you get Tokamak working. If you want, I can add ya to my MSN list so we can more closely talk about this sorta stuff. Your game is similar to mine in the respect that we both want a degree of realism.
#3
11/10/2005 (7:09 am)
Yes, do add me to your MSN list, I was planning on contracting you for some vehicle work in the near future as well. It probably won't be until the new year as Christmas is coming soon.

I would be happy to share resources with you, as game making is very tough. ;)

My plan is to get a demo level together to try and attract other team members, until then I'm going to do things myself or contract them out.
#4
11/10/2005 (7:49 am)
Search for a user named akio, he has done some amazing work with torque physics and collision. His changes have been voted higher than the ODE integration as well by quite a few people.
#5
11/10/2005 (10:01 am)
As far as the "feel" of the physics go. You can basically modify the ::updateForces function to create completely new physics implementation, but stay with in Torque's collision and networking systems. Looking and adding stuff here will probably give you the best gains.
#6
11/10/2005 (11:10 am)
Thanks everyone for the comments. Yea, I think what i need isn't to detailed so I might be able to do it with base Torque or ODE, some nice things in that too. I don't really need ragdoll physics or anything that advanced. Adding a more 'realistic' feel, through weight, the current tank pack tanks feel like they way about 200 pounds, some precise collisions for vehicles areas, different part of armor has different thickness and angles, and lastly objects that can be hit and knocked over by my vehicles, trees, sign posts, buildings. I think based on everything people have commented about here, I can do what I need.
#7
11/11/2005 (2:48 pm)
I feel kind of in vain here.. All the wheeled vehicles feels like they are driving on a icy lake, skidding all over. Its just not right. Been surfing these forums for days, and tried every possible number combination in the datablocks (pretty close anyways), without any luck.

Don't anyone have a fix for this though datablock number tweaks, scripting snippets or engine modifications? I don't know the torque engine source at any rate, so I find it a bit hard to figure out where to begin (yes, you can consider me a torque newbie;) )

Any help to make the buggy vehicle stop skidding around, and actually turn the direction the front wheels are pointing will be gratefully accepted.

I know there have been alot of these posts about vehicle handlig, but nothing of what I've read have been to much help. Somenoe must have figured this out by now :)
#8
11/11/2005 (4:36 pm)
With so many people here working on the same thing, we should really, instead of adding each other to our MSN lists, have a conference on Torque vehicle physics in IRC where we just get together and discuss stuff. I'm sure there's a lot of people that could share great ideas that way.
#9
11/11/2005 (6:37 pm)
Change these in your datablock and increase the engine torque, also increase the mass of the vehicle. Change the gravity in wheeledvehicle.cc to -45 from -20 and you will have a ok feel to start with. Then tweak till you get the feel you want.

staticFriction = 16;
kineticFriction = 10;

Something I have seen in other engines is how they handle torque is much different than how this engine deals with it. They use a gear ratio to calculate the torque to spin on the tires that would be a great field to add. If I can find the time I will look at it shouldn't be that hard.
#10
11/11/2005 (11:22 pm)
Thanks David, this improved the handling a great deal.

And I agree, that would be someting very nice to implement.

Thanks again.
#11
11/15/2005 (2:27 pm)
Mmhmm Please keep us updated on your progress, Dave. In the mean time I'll try these updates.
#12
11/15/2005 (3:27 pm)
@David.

There was a bug with StaticFriction but this has been fixed in 1.4 I believe.

Also I don't think Akio's Collision Enhancements are network aware so would only work with single player games, actually that might just be the ODE integrated physics not Akio's own improvements.

This resource adds network aware objects through a Rigid Shape Class.
#13
11/22/2005 (2:23 pm)
Forgot about this post for a while, for those watching it waiting for a answer I found this resource.

http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7903

it's how to add a transmission. Enjoy!

sorry for the delay on everything, I have been really busy and haven't had much chance to play with torque for some time.