I said it's 'sometimes' because I can't reproduce them always, but sometime. (with very high ratio)
Can I confirm is this a bug or my misconfiguration or environmental problem?
To reproduce:
Open BulletPhysics Demo, and find Demos/CcdPhysicsDemo/CcdPhysicsDemo.cpp
Replace this method with my one, compile and execute.
Code: Select all
void CcdPhysicsDemo::shootBox(const btVector3& destination)
{
if (m_dynamicsWorld)
{
float mass = 1.f;
btTransform startTransform;
startTransform.setIdentity();
btVector3 camPos = getCameraPosition();
startTransform.setOrigin(camPos);
setShootBoxShape ();
btRigidBody* body = this->localCreateRigidBody(mass, startTransform,m_shootBoxShape);
body->setLinearFactor(btVector3(1,1,1));
//body->setRestitution(1);
btVector3 linVel(destination[0]-camPos[0],destination[1]-camPos[1],destination[2]-camPos[2]);
linVel.normalize();
linVel*=m_ShootBoxInitialSpeed;
////////////////////////////////
// Here's bug reproduction code.
////////////////////////////////
linVel = btVector3(-553.138611, -665.362610, 3905.295410);
body->getWorldTransform().setOrigin(camPos);
body->getWorldTransform().setRotation(btQuaternion(0,0,0,1));
body->setLinearVelocity(linVel);
body->setAngularVelocity(btVector3(0,0,0));
body->setContactProcessingThreshold(1e30);
///when using m_ccdMode, disable regular CCD
if (m_ccdMode==USE_CCD)
{
body->setCcdMotionThreshold(0.0001);
body->setCcdSweptSphereRadius(0.4f);
}
}
}
I'll have another code can reproduce similar problem 'always'. However I can't sure about these problems are same because the code is using
Code: Select all
setLinearFactor(btVector3(1.0, 1.0, 0.0));
setAngularFactor(btVector3(0.0, 0.0, 1.0));