collision response for irregular angles
this is the problem. if i have a square area that the ball is bouncing in,I can make the ball bounce back when it hits the wall,but if I have irregular areas(like a circular area or an angled wall),the collision response is confusing me.
[edited by - tylerbingham on October 10, 2002 2:44:03 PM]
Its incredibly simple.
Take your velocity vector.
Take the normal vector of the plane you are colliding with.
rotate your velocity vector 180 degrees around the normal vector and reverse the resulting vector.
The resulting vector is your new velocity vector.
You''ll have to do some other stuff if you want to figure out the rotation of the object after collision.
Oh, to do the rotation in 3d, you can either use the 3 rotation matrices or quaternions. I suggest using quarternions becuase for some 3d rotations using the rotation matrices you get into a problem called "Gimbal Lock". You can do a google search and read all about it. Quarternions solve this problem.
Nitzan
-------------------------
www.geocities.com/nitzanw
www.scorchedearth3d.net
-------------------------
Take your velocity vector.
Take the normal vector of the plane you are colliding with.
rotate your velocity vector 180 degrees around the normal vector and reverse the resulting vector.
The resulting vector is your new velocity vector.
You''ll have to do some other stuff if you want to figure out the rotation of the object after collision.
Oh, to do the rotation in 3d, you can either use the 3 rotation matrices or quaternions. I suggest using quarternions becuase for some 3d rotations using the rotation matrices you get into a problem called "Gimbal Lock". You can do a google search and read all about it. Quarternions solve this problem.
Nitzan
-------------------------
www.geocities.com/nitzanw
www.scorchedearth3d.net
-------------------------
I think that a simpler way to do this is by using vector math.
You just have to subtract the double of the projected velocity on the normal vector. The equation is:
V'' = V - 2 * ( V * N ) / |N|
(the V * N is the dot product)
And if your have a unit normal vector, you can remove the division.
Hope this can help you!
Francis
You just have to subtract the double of the projected velocity on the normal vector. The equation is:
V'' = V - 2 * ( V * N ) / |N|
(the V * N is the dot product)
And if your have a unit normal vector, you can remove the division.
Hope this can help you!
Francis
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement