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; }
@Override public void addConstraint( TypedConstraint constraint, boolean disableCollisionsBetweenLinkedBodies) { constraints.add(constraint); if (disableCollisionsBetweenLinkedBodies) { constraint.getRigidBodyA().addConstraintRef(constraint); constraint.getRigidBodyB().addConstraintRef(constraint); } }
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()); }
@Override public void removeConstraint(TypedConstraint constraint) { constraints.remove(constraint); constraint.getRigidBodyA().removeConstraintRef(constraint); constraint.getRigidBodyB().removeConstraintRef(constraint); }