2 Wheel Collision Detection

In my new game, I have a motercycle that is driving over terrain, so I need to go about collision detection differently than golf. Right now I have the front wheel working correctly, it acts like gl golf right now.

Basically, how do I go about making it work with 2 seperate wheels, has anyone else done this before? I want it to look correct and act correct, so if you move over a cliff slightly the front wheel crawls over and then brings the rest over next

You might find SPK to come in handy here. I haven't really worked on it for a good month now, so I'll warn you that the documentation isn't really up to date. You'll also have to write a 3D terrain collider, I never got around to it.

The two things Scott pointed out are the way to go. That article rocks. I spent months trying to do something similar working out complex differential equations based on Newtonian physics and those ways suck. My missing key was verlet integration. The rest falls into place once you start using that.

I over-read where you said that you already had collisions working for the terrain. All you need to do now is simulate the back wheel the same way and "jam" them back together after colliding both wheels with the terrain independently of each other. It's such a simple solution that it made me cry having also spent so much time trying to figure out a "better" way like aarku was saying.

Simulating the wheels as spheres has some obvious limitations, but trying to do anything fancier will get really complicated really fast.

Anyway, feel free to poke around with SPK. If all you need now is some code to relax the link between the points, then you're in luck. That was the first thing that SPK did.

Skorche Wrote:I over-read where you said that you already had collisions working for the terrain. All you need to do now is simulate the back wheel the same way and "jam" them back together after colliding both wheels with the terrain independently of each other. It's such a simple solution that it made me cry having also spent so much time trying to figure out a "better" way like aarku was saying.

Simulating the wheels as spheres has some obvious limitations, but trying to do anything fancier will get really complicated really fast.

Anyway, feel free to poke around with SPK. If all you need now is some code to relax the link between the points, then you're in luck. That was the first thing that SPK did.

How do you recomend "Jamming" them back together, do you have any code or anything from that?

Yeah, get SPK. It's there. The function PK_projectParticlesWeighted is the function that actually moves the particles, and PK_relaxLink is the function that processes the link and calls the projection function.