Why Does My Box Collision Fail When Not a Cube?

  • Context: Graduate 
  • Thread starter Thread starter gc36
  • Start date Start date
  • Tags Tags
    Box
Click For Summary
SUMMARY

The discussion focuses on the challenges of implementing box collision detection in a physics engine, specifically when the box is not a cube. The user employs a formula involving contact normal, inverse inertia tensor, and restitution to calculate the impulse needed for bouncing. The issue arises when the box is tilted or has unequal dimensions, leading to incorrect impulse calculations due to the contact point not aligning with the center of mass. The user seeks clarification on whether torque considerations are adequately addressed in their calculations.

PREREQUISITES
  • Understanding of physics engine principles
  • Familiarity with collision detection algorithms
  • Knowledge of impulse and restitution in physics
  • Experience with vector mathematics and cross products
NEXT STEPS
  • Research "Physics Engine Collision Detection Techniques"
  • Study "Impulse and Torque Calculations in Rigid Body Dynamics"
  • Learn about "Handling Non-Uniform Box Collisions in Game Physics"
  • Explore "Implementing Contact Points and Normal Forces in Physics Engines"
USEFUL FOR

Game developers, physics engine programmers, and anyone involved in implementing realistic collision detection and response in 3D environments.

gc36
Messages
2
Reaction score
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?
 
Physics news on Phys.org
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?
 
yes - that's what the relative contact position etc.. does
 

Similar threads

  • · Replies 35 ·
2
Replies
35
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
2
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
12K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
25
Views
6K
  • · Replies 3 ·
Replies
3
Views
2K