Search in sources :

Example 1 with TypedConstraint

use of com.bulletphysics.dynamics.constraintsolver.TypedConstraint in project bdx by GoranM.

the class DiscreteDynamicsWorld method solveConstraints.

protected void solveConstraints(ContactSolverInfo solverInfo) {
    BulletStats.pushProfile("solveConstraints");
    try {
        // sorted version of all btTypedConstraint, based on islandId
        sortedConstraints.clear();
        for (int i = 0; i < constraints.size(); i++) {
            sortedConstraints.add(constraints.getQuick(i));
        }
        //Collections.sort(sortedConstraints, sortConstraintOnIslandPredicate);
        MiscUtil.quickSort(sortedConstraints, sortConstraintOnIslandPredicate);
        ObjectArrayList<TypedConstraint> constraintsPtr = getNumConstraints() != 0 ? sortedConstraints : null;
        solverCallback.init(solverInfo, constraintSolver, constraintsPtr, sortedConstraints.size(), debugDrawer, /*,m_stackAlloc*/
        dispatcher1);
        constraintSolver.prepareSolve(getCollisionWorld().getNumCollisionObjects(), getCollisionWorld().getDispatcher().getNumManifolds());
        // solve all the constraints for this island
        islandManager.buildAndProcessIslands(getCollisionWorld().getDispatcher(), getCollisionWorld().getCollisionObjectArray(), solverCallback);
        constraintSolver.allSolved(solverInfo, debugDrawer);
    } finally {
        BulletStats.popProfile();
    }
}
Also used : TypedConstraint(com.bulletphysics.dynamics.constraintsolver.TypedConstraint) TypedConstraint(com.bulletphysics.dynamics.constraintsolver.TypedConstraint) ManifoldPoint(com.bulletphysics.collision.narrowphase.ManifoldPoint)

Example 2 with TypedConstraint

use of com.bulletphysics.dynamics.constraintsolver.TypedConstraint in project bdx by GoranM.

the class RigidBody method addConstraintRef.

public void addConstraintRef(TypedConstraint c) {
    int index = constraintRefs.indexOf(c);
    if (index == -1) {
        constraintRefs.add(c);
    }
    checkCollideWith = true;
}
Also used : TypedConstraint(com.bulletphysics.dynamics.constraintsolver.TypedConstraint)

Example 3 with TypedConstraint

use of com.bulletphysics.dynamics.constraintsolver.TypedConstraint in project bdx by GoranM.

the class DiscreteDynamicsWorld method getConstraintIslandId.

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;
}
Also used : CollisionObject(com.bulletphysics.collision.dispatch.CollisionObject) TypedConstraint(com.bulletphysics.dynamics.constraintsolver.TypedConstraint) ManifoldPoint(com.bulletphysics.collision.narrowphase.ManifoldPoint)

Aggregations

TypedConstraint (com.bulletphysics.dynamics.constraintsolver.TypedConstraint)3 ManifoldPoint (com.bulletphysics.collision.narrowphase.ManifoldPoint)2 CollisionObject (com.bulletphysics.collision.dispatch.CollisionObject)1