Ammo js set generic constraint Limit

63 views Asked by At
var constraint = new Ammo.btGeneric6DofConstraint(
    body1,
    body2,
    new Ammo.btTransform(),
    new Ammo.btTransform(),
    false
    );
constraint.setLinearLowerLimit(new Ammo.btVector3(0, 0, 0));
constraint.setLinearUpperLimit(new Ammo.btVector3(0, 0, 0));
constraint.setAngularLowerLimit(new Ammo.btVector3(0, 0, 0));
constraint.setAngularUpperLimit(new Ammo.btVector3(0, 0, 0));
physicsWorld.addConstraint(constraint, true);

Using ammo.js
Trying to "anchor" or "freeze" two objects together (locking their relative position and rotation) using a constraint.

When I make a "btGeneric6DofConstraint" and set limits, it makes the position (or rotation) of both bodies NaN. I notice the same problem also happens when I try to set limits to the hinge constraint.

While testing:

The constraint does nothing if I don't have any limits.

The constraint does nothing if I add all except one of the angular limits.

The bodies are NAN if I add all of them.

Also did the same while testing with different Vector3 values

0

There are 0 answers