我想创建一个对象,而不仅要沿X和Z轴移动,同时还要使Y轴保持禁用状态(就像在2D模式下移动一样,该对象也不会掉落)。
我目前正在使用6自由度约束来限制Y轴上的移动,但是它不起作用:
btRigidBody* zeroBody = new btRigidBody(0, NULL, NULL); // Create the body that we attach things to
btRigidBody* robot = mCarChassis->getBulletRigidBody();
btGeneric6DofConstraint* constrict = new btGeneric6DofConstraint(*robot, *zeroBody, btTransform::getIdentity(), btTransform::getIdentity(), false);
constrict->setLinearLowerLimit( btVector3( 1, 1, 1));
constrict->setLinearUpperLimit( btVector3(-1, 1,-1));
constrict->setAngularLowerLimit( btVector3( 1, 1, 1) );
constrict->setAngularUpperLimit( btVector3(-1, -1, -1) );
mBulletWorld->getBulletDynamicsWorld()->addConstraint(constrict);
谢谢!
也许这将帮助:bulletphysics.org/Bullet/phpBB3/...,或许还为Y轴为0的下限/上限,而不是1
—
deceleratedcaviar