コード例 #1
0
  private static int getConstraintIslandId(TypedConstraint lhs) {
    int islandId;

    CollisionObject rcolObj0 = lhs.getRigidBodyA();
    CollisionObject rcolObj1 = lhs.getRigidBodyB();
    islandId = rcolObj0.getIslandTag() >= 0 ? rcolObj0.getIslandTag() : rcolObj1.getIslandTag();
    return islandId;
  }
コード例 #2
0
 @Override
 public void addConstraint(
     TypedConstraint constraint, boolean disableCollisionsBetweenLinkedBodies) {
   constraints.add(constraint);
   if (disableCollisionsBetweenLinkedBodies) {
     constraint.getRigidBodyA().addConstraintRef(constraint);
     constraint.getRigidBodyB().addConstraintRef(constraint);
   }
 }
コード例 #3
0
  protected void calculateSimulationIslands() {
    getSimulationIslandManager()
        .updateActivationState(getCollisionWorld(), getCollisionWorld().getDispatcher());
    int i;
    int numConstraints = constraints.size();
    for (i = 0; i < numConstraints; i++) {
      TypedConstraint constraint = constraints.getQuick(i);

      RigidBody colObj0 = constraint.getRigidBodyA();
      RigidBody colObj1 = constraint.getRigidBodyB();

      if (((colObj0 != null) && (!colObj0.isStaticOrKinematicObject()))
          && ((colObj1 != null) && (!colObj1.isStaticOrKinematicObject()))) {
        if (colObj0.isActive() || colObj1.isActive()) {
          getSimulationIslandManager()
              .getUnionFind()
              .unite((colObj0).getIslandTag(), (colObj1).getIslandTag());
        }
      }
    }
    // Store the island id in each body
    getSimulationIslandManager().storeIslandActivationState(getCollisionWorld());
  }
コード例 #4
0
 @Override
 public void removeConstraint(TypedConstraint constraint) {
   constraints.remove(constraint);
   constraint.getRigidBodyA().removeConstraintRef(constraint);
   constraint.getRigidBodyB().removeConstraintRef(constraint);
 }