1. Not finding help here? Sign up for a free 30min 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!

Help with collision scenario

  1. Jan 21, 2007 #1
    I'm trying to implement some physics in a game I'm coding and need help with understanding some basic concepts. I have two ships in space of different size and mass. Can somebody please explain to me how to determine what happens when the two ships collide? How do I know if when A collides with B: A might stop completely and move B, or A might move B and keep moving at a slower rate, or A might move B and bounce in the opposite direction?

    I don't know if this seems like a silly question or not but I would appreciate any help anyone can give. Thanks!
     
  2. jcsd
  3. Jan 21, 2007 #2

    ranger

    User Avatar
    Gold Member

    Last edited: Jan 21, 2007
  4. Jan 21, 2007 #3
    So, if I undertand this right, in an elastic collision the two objects basically exchange each others momentum so that no matter how massive object A is, if it hits a stationary object B, A will become stationary and launch B with its momentum? But in an inelastic collision the two objects will always "stick" and travel together at a lesser speed? I'm guessing my scenario is inelastic?
     
  5. Jan 21, 2007 #4
    The collision will conserve momentum. However, you have to choose yourself how quickly the ships separate from one another after the collision, by saying for example whether the ship's shields crumple to absorb some of the impact energy (sticking together in the most extreme case) or whether they explode releasing further energy (or neither, which is the elastic case).
     
  6. Jan 22, 2007 #5

    andrevdh

    User Avatar
    Homework Helper

    The maths can become a little challeging, but (barely) manageable.

    If you model the ships as two balls and consider their velocity components parallel to the line of action (line connecting their centers at point of impact)

    [tex]u_1,\ m_1,\ u_2,\ m_2[/tex]

    assuming no friction. You could set up two equations to solve for their final parallel velocity components

    [tex]v_1,\ v_2[/tex]

    by considering momentum conservation parallel to the line of action:

    [tex]m_1 u_1 - m_2 u_2 = m_2 v_2 - m_1 v_1[/tex]

    this assumes a + velocity component direction directed along [tex]u_1[/tex].

    Another equation is obtained by assuming a coefficient of restitution between the two ships

    [tex] 0 \leq e \leq 1[/tex]

    where 0 will give you an inelastic collision and 1 a perfectly elastic collision. To set up the equation you use the fact that

    [tex]e = \frac{relative\ speed\ of\ separation}{relative\ speed\ of\ approach}[/tex]

    which again will involve just the velocity components parallel to the line of action. Between these two equations you can then solve for

    [tex]v_1,\ v_2[/tex]

    The velocity components of the ships perpendicular to the line of action will then not be changed as a result of the collision.
     
    Last edited: Jan 22, 2007
  7. Jan 22, 2007 #6
    Ok, this is starting to make some sense now. So the coefficient of restitution controls the elasticity of a collision. Is it safe to say that it represents a ratio dictating how much the mass of the objects will influence the transfer of momentum? Is this coefficient constant between two objects, or does it vary based on other factors?

    Also, for a 3D scenario, do I split the velocity vectors into parallel and perpendicular components (to the line of action, right?), perform these calculations to transfer momentum on the parallel components and then add back the unmodified perpendicular components?

    And finally (sorry if I'm asking too much), how drastically do things change if the ships are moving AND rotating around their centers of mass? Is there some preliminary way of adding the rotation to the translation of the ships and still perform the same calculations?

    Thanks alot for your help thus far guys!
     
  8. Jan 23, 2007 #7

    andrevdh

    User Avatar
    Homework Helper

    The coeff of restitution is determined by the two materials and descibes how much the relative motion of the two colliding objects will be altered.

    Yes the procedure will be the same for 3D. The velocity components (and therefore the momentum) in a plane perpendicular to the line of action will be unaltered by the collision.

    If you consider rotation also things gets more complicated.

    Maybe you should try and get "Physics for game developers" by David M. Bourg. His book is mathematically advanced (with DirectX collision simulations in 3D). Although I did find some errors in his maths, but the simulations look realistic. The first chapter can put one off a bit since he discusses things like inertia tensors, but the maths are very neat and not that bad at all. I bought a secondhand copy from Amazon (it was brand new - I guess the game programmer gave it one look and was totally overwhelmed by the maths and send it back, but as I said it is really not that bad and quite understandable if you put the effort in and work through it).

    The example code is available at

    http://examples.oreilly.com/physicsgame/
     
    Last edited: Jan 23, 2007
  9. Jan 23, 2007 #8

    andrevdh

    User Avatar
    Homework Helper

    Made some slight changes to previous post.
     
  10. Jan 23, 2007 #9
    Thanks andrevdh, that might be the best way to go about it. I'll look through the sample programs and maybe get the book you suggested.
     
  11. Jan 24, 2007 #10

    andrevdh

    User Avatar
    Homework Helper

    As soon as one moves into 3D the maths gets quite advanced. But Bourg keeps it quite neat and organized - even his C++ programming is clear. Work through the book and post here for some help.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Help with collision scenario
  1. Collision help (Replies: 3)

  2. Collision help (Replies: 2)

  3. Collision help (Replies: 1)

Loading...