Skip to main content
GameDev.net gamedev.net
🔒 Locked

Collision response

Started by Shiftytitan Dec 15, 2002 at 2:41 AM 0 replies 900+ views
Original Post
Shiftytitan
Shiftytitan
Hi, i am confused, and stupid. how do i do a good collision response. I want to change the direction of a sphere, when it collides with a polygon. I already know how to change the colour, for, when a collison occurs.
Gee
Gee
Well, let''s call the triangle''s (the collision polygon) normal n. The velocity of the sphere v1, and the velocity after the impact v2.

The new velocity (v2) we will get through:

v2 . n = -ev1 . n

e is the coefficient of restitution, 1 if you want the ball to completely bounce, and 0 if you want it to stick to the wall.

The dots represent the dot product, there is a lot of good articles on it here at Gamedev...

I hope it gets you started... cheers

/Gee .
---GUI Programming Division Manager at Wildfire Gamesworking on the 0 A.D. project

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.