Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Colliding a box with the floor

  1. Jun 9, 2008 #1
    Hello
    I am programming a simple physics engine for a game.

    I am colliding a box with the 'floor' (inverseMass = 0). I detect the vertices of the box that collide with the floor, calculate the impulse required to get the box to bounce for each contact, and apply it to that contact. The calculation for the impulse uses the standard forumula :

    n is the contactNormal;
    iitw is the inverseInertiaTensor in world coordinates of the box
    r = relative position of contact point w.r.t centre of mass i.e (contactPoint - position of centre of mass)
    e = restitution

    numerator = -(1+e)relativeVelocity.Dot(n)
    denominator = (n.Dot(n) * inverseMass) + ((iitw*r.Cross(n)).Cross(r)).Dot(n)
    impulse = numerator/denominator;

    I find that this works when the box is a cube (length = breadth = height ) and bouncing with its base parallel to the floor. If all dimensions are not equal - or the box is tilted a bit it is wrong.
    Could somebody point out what I am doing wrong?
     
  2. jcsd
  3. Jun 9, 2008 #2

    HallsofIvy

    User Avatar
    Staff Emeritus
    Science Advisor

    It the box is tilted then one corner or edge will hit the floor first- the force will not be through the center of mass of the box. Are you taking into account the torque on the box?
     
  4. Jun 9, 2008 #3
    yes - thats what the relative contact position etc.. does
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Colliding a box with the floor
  1. Electrons collide (Replies: 4)

Loading...