How do i find the direction of impulse in 3d?

Click For Summary
To find the direction of impulse in a 3D collision between spheres, the impulse vector can be calculated using the difference in their center positions, normalized to ensure directionality. The approach involves disregarding tangential forces and focusing solely on the line connecting the centers of the spheres, which simplifies the problem significantly. For hard spheres with an elasticity of 1, the angular momentum is preserved, and the direction of the impulse is aligned with this line. The magnitude of the impulse is secondary to its direction in this context. Properly calculating the impulse direction is essential for accurate collision response in game physics.
1101
Messages
23
Reaction score
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
 
Physics news on Phys.org
If you have possibility of more than one collision at a time, I'd go with simulating forces instead and run collisions step-by-step. Just assume Hooke's law between them, and go with it. There are some pitfalls in that too, which I can tell you how to get around once you find problems, but it's still easier than trying to solve a multiple-collision.

Otherwise, if you prefer to do collision at-once, you need to consider two motions separately. The motion along the line connecting centers and motion perpendicular to it.

Motion along the line is a simple 1D collision. You'll need some sort of coefficient telling you how elastic collision will be, and then solve for conservation of momentum and energy loss appropriate for your coefficient.

The tangential component is more complicated if you want the spheres to have spin and surface friction. This is another reason to run it step-by-step. You can then just take force between spheres, use it as normal force, and with coefficient of friction figure out what the tangential force at the surface is.

I'd have to think about it a while to tell you how, or even if, it can be done in collision at-once. (It simply isn't done that way, normally, so I'd have to derive a few things from scratch.)

Edit: If you want, I can send you a source code for a simple pool simulation I wrote some time ago. It's not very clean, but it works, and you might pick up a few useful things from it.
 
You understand that all I need to find is the direction of the impulse right? I don't need the magnitude. Also really don't want any source code to spend hours digging through. This is evidently much hard than I thought. Also I'm just assuming everything has an elasticity of 1.
 
Heh. Can't blame you for not wanting to read the code.

Alright. If you assume a collision of two hard spheres with elasticity of 1, this problem can be greatly simplified.

Basically, you can disregard any tangential forces. Both spheres will preserve their angular momentum, and therefore their original angular speed.

The direction of impulse is then simply along the line that passes through centers of mass. So impulse for sphere 1 will have direction:

I_x = x_1 - x_2
I_y = y_1 - y_2
I_z = z_1 - z_2

Properly normalized, of course, as you originally suggested.

The actual speeds will only matter as far as magnitude of the impulse, not direction.
 
Are you sure? It doesn't seem to be working right
 
How are you computing the actual magnitude of the impulse?
 

Similar threads

Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 25 ·
Replies
25
Views
9K
  • · Replies 60 ·
3
Replies
60
Views
5K
  • · Replies 35 ·
2
Replies
35
Views
4K
  • · Replies 39 ·
2
Replies
39
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K