Game Development Community

2 Wheeled Vehicles

by Tony Richards · in Torque Game Engine · 04/29/2002 (9:07 am) · 3 replies

Funny, but not so funny...

I'm trying to put a motorcycle in game. Those familiar with the game engine already know what I'm about to say:

Two wheels, the vehicle just falls on its side.

It was pretty funny the first time it happened, but after working on it a bit I realized that I didn't have a solution.

The only hack that I can think of is to make the bounding box much larger at the base and set the body friction to a low number. Essentially this is like adding invisible "training wheels".

The only problem with this (other than the fact that it's a horrible hack) is that clipping an object fairly closely would cause an unexpected collision.

Now I understand why the only motorcycle type vehicles I've seen have been grav cycles.

Any suggestions or ideas on how to make a two wheeled vehicle? I suppose I'll simply have to combine the grav and wheeled vehicle code. The "banking" code is in the grav class, so this will probably be the best solution. I've never taken physics so hopefully I can do this with simple "hack and slash" coding.

For now I've just modified the axles a bit and turned it into an ATV. Really fun, really fast, but not exactly what I had in mind.

About the author

I am the founder of IndieZen.org, a website dedicated to the Indie 2.0 Revolution where a number of Indie game development studios and individuals collaborate and share a suite of custom built open source game development tools and middleware.


#1
04/29/2002 (11:43 am)
I made a vespa that works ok, it's not perfect yet but it's drivable and doesn't tip over. It was really tricky to get working at all though. Play around with the center of mass a lot, the smallest adjustment can have a big effect. I don't have the files here, but I know there was a lot of settings in the script that I had to tweak and re tweak. I'll take a look later and post some of the datablock. One thing I remember is that I had to give it bigger mass then I would have thought, I think I have it set at like 300 or so, but that depends a lot on your other settings.
#2
04/29/2002 (1:49 pm)
The "real" solution would probably involve adding some sort of gyroscope to keep the vehicle upright. It would mean changing the code, it wouldn't be too hard though. I believe there there is some similar gyro code in the hover vehicle, might be easy to cut & paste that code over :)
#3
04/29/2002 (3:10 pm)
I've done 3 Harley-Davidson Motorcycle games and a Kawasaki one... these all used Ipion (now Havok) physics... getting a bike to stand up is somewhat problematic, this was solved with a keep-upright motion controller... which simply for the desired y_angle of 0.0 applied torque on the Z axis... this is the easy part

Now where we had difficulty is in getting this to behave like a damned motorcycle :) People have definate ideas how one should drive.. our reviews substantiate this *ahem*...

Depending on the realism you are after this will be very quick or endless... what I found is that depending on the physics simulation, sometimes unrealistic settings give more realistic feel to the vehicle... I ended up with an ass heavy front wheel which was slightly bigger then the rear and allowed the graphics to compenstate somewhat...

Good luck!
-J