Requirement
Use Transform to control rigid body motion and collide with other non-static rigid bodies, but not change direction.
Test program
Set rigid body to kinematics
Code: Select all
kBox->setCollisionFlags(kBox->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT);
kBox->setActivationState(DISABLE_DEACTIVATION);
Code: Select all
void RollingFrictionDemo::stepSimulation(float deltaTime)
{
CommonRigidBodyBase::stepSimulation(deltaTime);
if (run123)
{
btMotionState* state = kBox->getMotionState();
btTransform s;
state->getWorldTransform(s);
s.setOrigin(s.getOrigin() + btVector3(deltaTime, 0, 0));
state->setWorldTransform(s);
}
}
Kinematic rigid bodies collide with other rigid bodies and penetrate them Expected effect
I did a similar test using unity3d Same problem
Some people in the forum raised similar questions and proposed a solution. After testing, I found that the effect is a bit problematic, Rigid bodies will lateral jitter.
Code: Select all
m_dynamicsWorld->getSolverInfo().m_erp2 = 1.0f;
1.How do I change the settings to achieve the effect.
2.Is there a related document describing the role of the btContactSolverInfo property
Thank you!