Search in sources :

Example 1 with ContactSolverInfo

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

the class SimpleDynamicsWorld method stepSimulation.

/**
	 * maxSubSteps/fixedTimeStep for interpolation is currently ignored for SimpleDynamicsWorld, use DiscreteDynamicsWorld instead.
	 */
@Override
public int stepSimulation(float timeStep, int maxSubSteps, float fixedTimeStep) {
    // apply gravity, predict motion
    predictUnconstraintMotion(timeStep);
    DispatcherInfo dispatchInfo = getDispatchInfo();
    dispatchInfo.timeStep = timeStep;
    dispatchInfo.stepCount = 0;
    dispatchInfo.debugDraw = getDebugDrawer();
    // perform collision detection
    performDiscreteCollisionDetection();
    // solve contact constraints
    int numManifolds = dispatcher1.getNumManifolds();
    if (numManifolds != 0) {
        ObjectArrayList<PersistentManifold> manifoldPtr = ((CollisionDispatcher) dispatcher1).getInternalManifoldPointer();
        ContactSolverInfo infoGlobal = new ContactSolverInfo();
        infoGlobal.timeStep = timeStep;
        constraintSolver.prepareSolve(0, numManifolds);
        constraintSolver.solveGroup(null, 0, manifoldPtr, 0, numManifolds, null, 0, 0, infoGlobal, debugDrawer, /*, m_stackAlloc*/
        dispatcher1);
        constraintSolver.allSolved(infoGlobal, debugDrawer);
    }
    // integrate transforms
    integrateTransforms(timeStep);
    updateAabbs();
    synchronizeMotionStates();
    clearForces();
    return 1;
}
Also used : ContactSolverInfo(com.bulletphysics.dynamics.constraintsolver.ContactSolverInfo) PersistentManifold(com.bulletphysics.collision.narrowphase.PersistentManifold) CollisionDispatcher(com.bulletphysics.collision.dispatch.CollisionDispatcher) DispatcherInfo(com.bulletphysics.collision.broadphase.DispatcherInfo)

Aggregations

DispatcherInfo (com.bulletphysics.collision.broadphase.DispatcherInfo)1 CollisionDispatcher (com.bulletphysics.collision.dispatch.CollisionDispatcher)1 PersistentManifold (com.bulletphysics.collision.narrowphase.PersistentManifold)1 ContactSolverInfo (com.bulletphysics.dynamics.constraintsolver.ContactSolverInfo)1