- #1
1101
- 23
- 0
I'm writing a game that involves collisions with spheres. Anyway each sphere has both angular and linear velocity. These two spheres collide. I need to find the direction of the impulse between them (if that's the right wording). I tried just subtracting their linear velocity components like this:
implusex = sphere1xspeed - sphere2xpseed;
implusey = sphere1yspeed - sphere2zpseed;
implusez = sphere1zspeed - sphere2zpseed;
(at which point I would then normalize the vector)
This seems to work for calculating the linear velocity after the collision but what happens is that the magnitude of the impulse is 0 when there is no linear velocity. This creates a problem with things like gears which may be locked into a fixed location in space but have angular velocity.
I should point out that since I'm working in a game environment I do not know what the final linear/angular velocity of the spheres is.
I'm using the formula found here to calculate the magnitude of impulse and do other physics things: http://www.euclideanspace.com/physics/dynamics/collision/threed/index.htm
implusex = sphere1xspeed - sphere2xpseed;
implusey = sphere1yspeed - sphere2zpseed;
implusez = sphere1zspeed - sphere2zpseed;
(at which point I would then normalize the vector)
This seems to work for calculating the linear velocity after the collision but what happens is that the magnitude of the impulse is 0 when there is no linear velocity. This creates a problem with things like gears which may be locked into a fixed location in space but have angular velocity.
I should point out that since I'm working in a game environment I do not know what the final linear/angular velocity of the spheres is.
I'm using the formula found here to calculate the magnitude of impulse and do other physics things: http://www.euclideanspace.com/physics/dynamics/collision/threed/index.htm