Physics Collision Response for boxes

This topic is 2604 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hello everyone,

As a final project for school, a friend and I are making a basic 3D physics engine. We've made a lot of progress since we started, but there's a topic we've had a lot of trouble with: calculating the effects(velocity, direction, etc.) how a collision affects the two objects that have collided. We've already found a way to do this for point-masses (spheres in this case) thanks to the great help at physforum.com. But we're having problems with the box-solid, specifically, with the rotational velocity.

We have an (axis-aligned,) rotating box colliding with a sphere. The box has a width of Bw, a length of Bl and a depth of Bd. The box' mass is mb, the sphere's mass is ms. We have the point of collision, which is (cx,cy,cz). The box has a speed of (vbx, vby, vbz) and a rotational speed of (vbrx, vbry, vbrz). The sphere has a speed of (vsx, vsy, vsz). After the collision, the box has a speed of (vbx', vby', vbz'), rotates with (vbrx', vbry', vbrz') and the sphere has a speed of (vsx', vsy', vsz'). Conservation of energy and momentum both apply.

Our first thought was that we would replace the box with a point mass positioned at the point of collision but after some further thinking we realized that this is not correct on the level of physics, since the mass is not divided uniformly from that point mass on. If that is indeed so, how *do* we solve this problem? (solving must be done analytically, not numerically! However, it may be done numerically if the computer solves it.)

We appreciate any help any of you can give us.

Share on other sites
To summarize a little bit.

Each shape will be referred to as a body, with state variables ( P - position of center of mass, A - Orientation, V - linear velocity, W - angular velocity )

The center of mass of each body will be offset from the contact pt by some extension. This extension is what will result in torque changing the angular velocity.

Your force function will look something like this:
 Body::AddForce( worldForce, worldPt, dt ) { //linear V += force / Mass * dt; //angular vec3 offset = worldPt - P; W += CrossProduct( offset, force ) / Inertia * dt } //And each step you're probably doing something like this: Body::Step( dt ) { P += V * dt; A += W * dt; } 

Here's a good tutorial on computing the force or impulse to apply. But if you're doing it in 3d then i recommend using baraff's paper because the 2d -> 3d conversion is not intuitive, lots of stuff has been reduced.
http://myphysicslab.com/collision.html

Baraff derives the same equation in figure (8-18 Here

1. 1
2. 2
3. 3
Rutin
25
4. 4
5. 5
khawk
14

• 11
• 11
• 23
• 10
• 9
• Forum Statistics

• Total Topics
633650
• Total Posts
3013119
×