Colliding a box with the floor

  • Thread starter gc36
  • Start date
  • #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
HallsofIvy
Science Advisor
Homework Helper
41,847
969
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 on Colliding a box with the floor

  • Last Post
Replies
5
Views
2K
Replies
1
Views
1K
  • Last Post
Replies
5
Views
2K
  • Last Post
Replies
17
Views
2K
  • Last Post
Replies
3
Views
2K
Replies
3
Views
992
  • Last Post
Replies
15
Views
4K
  • Last Post
Replies
6
Views
2K
Replies
4
Views
807
Top