Page 1 of 1

How to control forces of kinematic body against rigid body

Posted: Tue Dec 14, 2010 11:40 am
by JayAr
Hi,
Lets say I have Kinematic Body A which has a specific velocity and pushes against Ridig Body B. It now applies some force against the Rigid Body, pushing it away. Now since Body A is Kinematic, it doesnt matter which mass the Rigid Body B has. It always gets pushed away the same distance, if the velocity of A doesnt change.

But is there a way to control the amount of forces a Kinematic Body can apply to a Rigid Body??

Because in the end, I have a Ping Pong simulation where I can control the Ping Pong Racket (which is Kinematic) and I can hit a ball with it, but in my opinion the forces applied to the ball are way too much. Can I just at some point set a flag which says the Kinematic Body should always apply half the forces it normally would?

Code: Select all

// This is my Kinematic Body:
btRigidBody* kinematicBody;                          // I set it Kinematic somewhere else

//And this is how I update the position and orientation of the body
btTransform T;
kinematicBody->getMotionState()->setWorldTransform(T);
So I'd really like to have more control over the simulation with Kinematic Bodies.

Re: How to control forces of kinematic body against rigid bo

Posted: Wed Dec 15, 2010 11:04 am
by Johan Gidlund
I have not worked with Bullet in a long time so I don't know exactly how things work in it.
But talking for a general perspective mass should effect the force of the collision even for a keyframed object?
Tweaking restitution should also change the behavior.

Re: How to control forces of kinematic body against rigid bo

Posted: Wed Dec 15, 2010 1:30 pm
by JayAr
Thanks, changing restitution of the Kinematic and Rigid Body actually did change the effect a bit. But the lowest value you can set is 0 and even then the forces applied are too high, plus the ball needs at least some restitution to be able to bounce.
Changing the mass of the kinematic body is not possible, since kinematic bodies always have a mass of 0, and changing the mass of the rigid body doesnt change anything regarding the interaction with the kinematic body.

So I hope I can somehow change the effect by changing something in the motion state, but I dont know how exactly.