Colliding a box with the floor

  • Thread starter gc36
  • Start date
  • Tags
    Box
  • #1
2
0
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?
 

Answers and Replies

  • #2
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?
 
  • #3
yes - that's what the relative contact position etc.. does
 

Suggested for: Colliding a box with the floor

Replies
3
Views
1K
Replies
4
Views
3K
Replies
16
Views
3K
Replies
5
Views
434
Replies
10
Views
2K
Replies
5
Views
2K
Replies
15
Views
1K
Replies
3
Views
800
Back
Top