1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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

  1. Jun 19, 2010 #1
    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
     
  2. jcsd
  3. Jun 19, 2010 #2

    K^2

    User Avatar
    Science Advisor

    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.
     
  4. Jun 19, 2010 #3
    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.
     
  5. Jun 19, 2010 #4

    K^2

    User Avatar
    Science Advisor

    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:

    [tex]I_x = x_1 - x_2[/tex]
    [tex]I_y = y_1 - y_2[/tex]
    [tex]I_z = z_1 - z_2[/tex]

    Properly normalized, of course, as you originally suggested.

    The actual speeds will only matter as far as magnitude of the impulse, not direction.
     
  6. Jun 19, 2010 #5
    Are you sure? It doesn't seem to be working right
     
  7. Jun 19, 2010 #6

    K^2

    User Avatar
    Science Advisor

    How are you computing the actual magnitude of the impulse?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook