Where are the collisions are handled?

shultays
Posts: 4
Joined: Thu Apr 09, 2015 2:34 pm

Where are the collisions are handled?

Post by shultays »

I am trying to handle collisions in a custom way, I want rigid bodies to get pushed away from the other collided correctly but I want them not to lose all kinetic energy they had.

The reason is I am trying to create rigid bodies that can be damaged, the side that hits the wall will be crushed for example. When a rigid body hits a wall, I want to absorb some of the kinetic energy change as a damage and reduce the deceleration of the rigid body that is caused by collision. In further frames, if rigid body were fast enough, it can hit the wall again and again and get further damaged. I can't do this in a single frame because as soon as a car hit a wall, it would lose half the body it had and it would look weird. Imagine a car hit a wall and getting crushed.
shultays
Posts: 4
Joined: Thu Apr 09, 2015 2:34 pm

Re: Where are the collisions are handled?

Post by shultays »

I think I found it

Code: Select all

btSequentialImpulseConstraintSolver::solveGroupCacheFriendlyIterations

Code: Select all

btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySplitImpulseIterations
first solves the penetrations then in

Code: Select all

btSequentialImpulseConstraintSolver::solveSingleIteration
it computes the new velocities. So I think I can update m_tmpSolverContactConstraintPool between them to reduce effect of the impulses on velocities, am I doing this right?