iDevGames Forums
2 Wheel Collision Detection - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: 2 Wheel Collision Detection (/thread-6457.html)



2 Wheel Collision Detection - Jake - Jul 12, 2004 10:53 AM

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


2 Wheel Collision Detection - Skorche - Jul 12, 2004 11:31 AM

This should give you a pretty good idea of how to do it.
Gamasutra article

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.

SPK


2 Wheel Collision Detection - aarku - Jul 12, 2004 11:56 AM

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.

It works greatly.

-Jon


2 Wheel Collision Detection - Jake - Jul 12, 2004 12:20 PM

I just read the article, and I think I have a general idea of how to do it, I will definitly read it again, and then try it out in a 2D environment first Smile


2 Wheel Collision Detection - Skorche - Jul 12, 2004 04:09 PM

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.


2 Wheel Collision Detection - Jake - Jul 12, 2004 06:47 PM

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?


2 Wheel Collision Detection - Skorche - Jul 13, 2004 10:50 AM

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.


2 Wheel Collision Detection - Jake - Aug 9, 2004 12:20 PM

I decided to add this link to my new thread with the results - http://www.idevgames.com/forum/showthread.php?p=65005#post65005 in case anyone is searching, adding this to my motorcycle is going to be so easy Smile