Hello,

Where can I find the physics equations implemented by the Bullet Physics Engine? Specifically, I am looking for the equations that govern the collisions in a pybullet simulation. If two objects are created in collision (sharing some or all the same mesh points), they push each other out.

1) What are the equations that govern the forces that push the objects out of each other?

2) Is there a way to control the forces such that they don't act in the z direction at all? That way they would push each other out, but only in the x and y directions.

Any help is very much appreciated!

## Bullet Physics Equations

- drleviathan
**Posts:**371**Joined:**Tue Sep 30, 2014 6:03 pm**Location:**San Francisco

### Re: Bullet Physics Equations

What do you really want to do? Are you trying to use Bullet in 2D mode?

You can limit a btRigidBody to move in its XY plane and only rotate about Z like so:

You can limit a btRigidBody to move in its XY plane and only rotate about Z like so:

Code: Select all

```
body->setLinearFactor(btVector3(1,0,1));
body->setAngularFactor(btVector3(0,1,0));
```

### Re: Bullet Physics Equations

Thank you very much!

I'm trying to do just that but in Python, do you know if that is possible?

Also, I'm trying to find the governing equations. When two objects are created in collision, and they push each other out, how is the resulting force calculated? Is it modeled as an (most probably) elastic or non-elastic collision?

From highschool, I remember (m1*v1) + (m2*v2) = (m1*v1') + (m2*v2'), and that is related to the force. But when two objects are simply created in a simulation, what is their initial velocity assumed as?

I'm trying to do just that but in Python, do you know if that is possible?

Also, I'm trying to find the governing equations. When two objects are created in collision, and they push each other out, how is the resulting force calculated? Is it modeled as an (most probably) elastic or non-elastic collision?

From highschool, I remember (m1*v1) + (m2*v2) = (m1*v1') + (m2*v2'), and that is related to the force. But when two objects are simply created in a simulation, what is their initial velocity assumed as?

- drleviathan
**Posts:**371**Joined:**Tue Sep 30, 2014 6:03 pm**Location:**San Francisco

### Re: Bullet Physics Equations

For normal collisions I believe the ContactPoint is processed like a "constraint", which means the forces of the event are implicit in the solution. In short: a Jacobian matrix is computed and the problem comes down to the solving the Ax = b matrix equation, where x is a vector of unknown values for which we're trying to solve: positions and velocities <x, y, z, Vx, Vy, Vz, qx, qz, qy, qw, ωx, ωy, ωz>. The A matrix must be inverted and then x can be computed: A'b = x The method doesn't bother to compute the intermediary forces.

When two objects significantly overlap I don't know what happens. Bullet has some "inter-penetration resolution" code that will push penetrating objects apart without pumping too much energy into the system but I don't know how it works.

When two objects significantly overlap I don't know what happens. Bullet has some "inter-penetration resolution" code that will push penetrating objects apart without pumping too much energy into the system but I don't know how it works.