git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@103 92aac97c-a6ce-11dd-a772-7fcde58d38e6

This commit is contained in:
chappuis.daniel 2009-02-13 15:42:42 +00:00
parent ddb7d8309a
commit bf9fdbe7d3

View File

@ -59,7 +59,7 @@ DerivativeBodyState NumericalIntegrator::evaluate(BodyState& bodyState, const Ti
// Compute the derivaties values at time t // Compute the derivaties values at time t
Vector3D linearVelocity = bodyState.getLinearVelocity(); Vector3D linearVelocity = bodyState.getLinearVelocity();
Vector3D force = bodyState.computeForce(time); Vector3D force = bodyState.computeForce(time + timeStep);
Vector3D torque = bodyState.computeTorque(time + timeStep); Vector3D torque = bodyState.computeTorque(time + timeStep);
Quaternion spin = bodyState.getSpin(); Quaternion spin = bodyState.getSpin();
@ -82,7 +82,7 @@ void NumericalIntegrator::integrate(BodyState& bodyState, const Time& time, cons
d.getLinearVelocity()) * (1.0/6.0) * dt); d.getLinearVelocity()) * (1.0/6.0) * dt);
bodyState.setLinearMomentum(bodyState.getLinearMomentum() + (a.getForce() + (b.getForce() + c.getForce())*2.0 + d.getForce()) * (1.0/6.0) * dt); bodyState.setLinearMomentum(bodyState.getLinearMomentum() + (a.getForce() + (b.getForce() + c.getForce())*2.0 + d.getForce()) * (1.0/6.0) * dt);
bodyState.setOrientation(bodyState.getOrientation() + (a.getSpin() + (b.getSpin() + c.getSpin())*2.0 + d.getSpin()) * (1.0/6.0) * dt); bodyState.setOrientation(bodyState.getOrientation() + (a.getSpin() + (b.getSpin() + c.getSpin())*2.0 + d.getSpin()) * (1.0/6.0) * dt);
bodyState.setAngularMomentum(bodyState.getAngularMomentum() + (a.getTorque() + (b.getTorque() + c.getTorque())*2.0 + d.getTorque()) * (1.0/6.0) * dt ); bodyState.setAngularMomentum(bodyState.getAngularMomentum() + (a.getTorque() + (b.getTorque() + c.getTorque())*2.0 + d.getTorque()) * (1.0/6.0) * dt);
// Recalculate the secondary values of the body state // Recalculate the secondary values of the body state
bodyState.recalculate(); bodyState.recalculate();