| 58 | | NewtonConstraintCreateUpVector(dynamic_cast<PhysicsZone*>(m_pShape->getPhysicsZone().get())->getZonePtr(), _upVector.m_array, dynamic_cast<PhysicsActor*>(m_pShape.get())->getActorPtr()); |
| | 60 | //reference: http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=4457&hilit=keep+body+upright |
| | 61 | // and http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=2027&hilit=+new+btGeneric6DofConstraint+ |
| | 62 | // see btRotationalLimitMotor::testLimitValue specificly |
| | 63 | |
| | 64 | btTransform trans = btTransform(btQuaternion(_upVector.m_x,_upVector.m_y,_upVector.m_z)); |
| | 65 | m_pConstraint = new btGeneric6DofConstraint(*(static_cast<PhysicsActor*>(m_pShape.get())->getActorPtr()), |
| | 66 | *(static_cast<PhysicsActor*>(m_pShape.get())->getActorPtr()), trans, trans.inverse(), false); |
| | 67 | |
| | 68 | m_pConstraint->setAngularLowerLimit(btVector3(FLT_MAX,0,0)); |
| | 69 | m_pConstraint->setAngularUpperLimit(btVector3(-FLT_MAX,0,0)); |
| | 70 | |
| | 71 | //NewtonConstraintCreateUpVector(dynamic_cast<PhysicsZone*>(m_pShape->getPhysicsZone().get())->getZonePtr(), _upVector.m_array, dynamic_cast<PhysicsActor*>(m_pShape.get())->getActorPtr()); |