Colliding a box with the floor

  • Thread starter gc36
  • Start date
  • #1
2
0

Main Question or Discussion Point

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
HallsofIvy
Science Advisor
Homework Helper
41,794
923
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
2
0
yes - thats what the relative contact position etc.. does
 

Related Threads for: Colliding a box with the floor

Replies
3
Views
3K
  • Last Post
Replies
5
Views
1K
  • Last Post
Replies
5
Views
1K
Replies
9
Views
10K
Replies
2
Views
399
  • Last Post
Replies
5
Views
939
Replies
2
Views
1K
Top