Search in sources :

Example 1 with DispatcherInfo

use of com.bulletphysics.collision.broadphase.DispatcherInfo in project bdx by GoranM.

the class DiscreteDynamicsWorld method internalSingleStepSimulation.

protected void internalSingleStepSimulation(float timeStep) {
    BulletStats.pushProfile("internalSingleStepSimulation");
    Stack stack = Stack.enter();
    int sp = stack.getSp();
    try {
        // apply gravity, predict motion
        predictUnconstraintMotion(timeStep);
        DispatcherInfo dispatchInfo = getDispatchInfo();
        dispatchInfo.timeStep = timeStep;
        dispatchInfo.stepCount = 0;
        dispatchInfo.debugDraw = getDebugDrawer();
        // perform collision detection
        performDiscreteCollisionDetection();
        calculateSimulationIslands();
        getSolverInfo().timeStep = timeStep;
        // solve contact and other joint constraints
        solveConstraints(getSolverInfo());
        //CallbackTriggers();
        // integrate transforms
        integrateTransforms(timeStep);
        // update vehicle simulation
        updateActions(timeStep);
        // update vehicle simulation
        updateVehicles(timeStep);
        updateActivationState(timeStep);
        if (internalTickCallback != null) {
            internalTickCallback.internalTick(this, timeStep);
        }
    } finally {
        BulletStats.popProfile();
        stack.leave(sp);
    }
}
Also used : DispatcherInfo(com.bulletphysics.collision.broadphase.DispatcherInfo) TypedConstraint(com.bulletphysics.dynamics.constraintsolver.TypedConstraint) ManifoldPoint(com.bulletphysics.collision.narrowphase.ManifoldPoint) Stack(com.bulletphysics.util.Stack)

Example 2 with DispatcherInfo

use of com.bulletphysics.collision.broadphase.DispatcherInfo 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)2 CollisionDispatcher (com.bulletphysics.collision.dispatch.CollisionDispatcher)1 ManifoldPoint (com.bulletphysics.collision.narrowphase.ManifoldPoint)1 PersistentManifold (com.bulletphysics.collision.narrowphase.PersistentManifold)1 ContactSolverInfo (com.bulletphysics.dynamics.constraintsolver.ContactSolverInfo)1 TypedConstraint (com.bulletphysics.dynamics.constraintsolver.TypedConstraint)1 Stack (com.bulletphysics.util.Stack)1