我用铰链限制器创建了一扇门,它的表现或多或少可以接受,只是一旦达到最大或最小旋转角度极限,它就会弹回一点。是什么原因导致这种后坐力,我该如何预防?
我希望门一到达最大/最小角度就立即停止。
const float mass = 10.0f;
BoxShape boxShape = new BoxShape(Door.CollisionShape);
Vector3 pivotA = new Vector3(-Door.CollisionShape.X, Door.CollisionShape.Y, Door.CollisionShape.Z);
door.rigidBody = physics.LocalCreateRigidBody(mass, door.getRotationMatrix() * Matrix4.CreateTranslation(position), boxShape);
door.rigidBody.ActivationState = ActivationState.DisableDeactivation;
door.rigidBody.UserObject = "Door";
var axisA = Vector3.UnitY; // pointing upwards, aka Y-axis
var hinge = new HingeConstraint(door.rigidBody, pivotA, axisA);
hinge.SetLimit(-(float)Math.PI * 0.25f, 0);
physics.World.AddConstraint(hinge);