I want to determine when one (ball) touches another object (goal), and I want to know the momentum of this contact.
I know three ways to detect contacts
gContactAddedCallback
or
int numManifolds = m_dynamicsWorld->getDispatcher()->getNumManifolds(); for (int i=0;i<numManifolds;i++) { btRigidBody* obA = static_cast<btRigidBody*>(contactManifold->getBody0()); btRigidBody* obB = static_cast<btRigidBody*>(contactManifold->getBody1());
or
Check ramp and angular. (It is unclear whether the contact was and which object changed speed, whether it was an object or damping, gravity, or some force field.
I want to have contact information to enable the momentum of contacts. I noticed that some kind of contact is allowed in 1 frame simulation, others take 2 frames, and the impulse is half as low. (I got the debugging code.) I would be ideal to get 1 contact message with a full boost.
None of the methods I have listed give me complete contact information. For some time he shoots when the ball flies near the target and does not even touch it.
What is the expected way to do this?
Such information could be used to play a percussive sound or start an animation if the contact energy is high.
Max
source share