Fixed consistency of Trajectories with different time steps #436
|
@ -269,9 +269,7 @@ namespace SHADE
|
|||
|
||||
double accumulatedTime = 0.0f;
|
||||
|
||||
bool terminate = true;
|
||||
int iterationCounter = simInfo.maxSteps;
|
||||
|
||||
int iterationCounter = simInfo.maxSteps;
|
||||
do
|
||||
{
|
||||
accumulatedTime += simInfo.timeStep;
|
||||
|
@ -280,21 +278,22 @@ namespace SHADE
|
|||
raycastInfo.ray.position = ghostBody.position;
|
||||
raycastInfo.ray.direction = SHVec3::Normalise(ghostBody.linearVelocity);
|
||||
|
||||
terminate = !Raycast(raycastInfo).empty() || iterationCounter == 0;
|
||||
if (terminate)
|
||||
if (!Raycast(raycastInfo).empty())
|
||||
return;
|
||||
|
||||
while (accumulatedTime > fixedDT)
|
||||
{
|
||||
simulateBody(ghostBody, simInfo);
|
||||
accumulatedTime -= fixedDT;
|
||||
}
|
||||
|
||||
|
||||
if (!simInfo.continuousForce)
|
||||
{
|
||||
simInfo.force = SHVec3::Zero;
|
||||
simInfo.torque = SHVec3::Zero;
|
||||
if (!simInfo.continuousForce)
|
||||
{
|
||||
simInfo.force = SHVec3::Zero;
|
||||
simInfo.torque = SHVec3::Zero;
|
||||
}
|
||||
|
||||
if (--iterationCounter == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
if (output.positions)
|
||||
|
@ -303,8 +302,6 @@ namespace SHADE
|
|||
if (output.orientations)
|
||||
output.orientations->emplace_back(ghostBody.orientation);
|
||||
|
||||
--iterationCounter;
|
||||
|
||||
} while (true);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue