|
|
@ -626,15 +626,15 @@ void plSimulationMgr::Advance(float delSecs) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (fExtraProfile) |
|
|
|
if (fExtraProfile) |
|
|
|
Log("Step clamped from %f to limit of %f", fAccumulator, fMaxDelta); |
|
|
|
Log("Step clamped from %f to limit of %f", fAccumulator, fMaxDelta); |
|
|
|
fAccumulator = fMaxDelta; |
|
|
|
fAccumulator = kDefaultMaxDelta; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
++fStepCount; |
|
|
|
++fStepCount; |
|
|
|
|
|
|
|
|
|
|
|
// Perform as many whole substeps as possible saving the remainder in our accumulator.
|
|
|
|
// Perform as many whole substeps as possible saving the remainder in our accumulator.
|
|
|
|
int numSubSteps = (int)(fAccumulator / fStepSize + 0.000001f); |
|
|
|
int numSubSteps = (int)(fAccumulator / fStepSize + 0.000001f); |
|
|
|
float delta = numSubSteps * fStepSize; |
|
|
|
float delta = numSubSteps * fStepSize; |
|
|
|
fAccumulator -= delta; |
|
|
|
fAccumulator -= delta; |
|
|
|
|
|
|
|
|
|
|
|
plProfile_IncCount(StepLen, (int)(delta*1000)); |
|
|
|
plProfile_IncCount(StepLen, (int)(delta*1000)); |
|
|
|
plProfile_BeginTiming(Step); |
|
|
|
plProfile_BeginTiming(Step); |
|
|
@ -783,25 +783,21 @@ void plSimulationMgr::ISendUpdates() |
|
|
|
// RESOLUTION & TIMEOUT PARAMETERS
|
|
|
|
// RESOLUTION & TIMEOUT PARAMETERS
|
|
|
|
//
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
void plSimulationMgr::SetMaxDelta(float maxDelta) |
|
|
|
void plSimulationMgr::SetMaxDelta(float maxDelta) |
|
|
|
{ |
|
|
|
{ |
|
|
|
fMaxDelta = maxDelta; |
|
|
|
fMaxDelta = maxDelta; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
float plSimulationMgr::GetMaxDelta() const |
|
|
|
float plSimulationMgr::GetMaxDelta() const |
|
|
|
{ |
|
|
|
{ |
|
|
|
return fMaxDelta; |
|
|
|
return fMaxDelta; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void plSimulationMgr::SetStepsPerSecond(int stepsPerSecond) |
|
|
|
void plSimulationMgr::SetStepsPerSecond(int stepsPerSecond) |
|
|
|
{ |
|
|
|
{ |
|
|
|
fStepSize = 1.0f / (float)stepsPerSecond; |
|
|
|
fStepSize = 1.0f / (float)stepsPerSecond; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int plSimulationMgr::GetStepsPerSecond() |
|
|
|
int plSimulationMgr::GetStepsPerSecond() |
|
|
|
{ |
|
|
|
{ |
|
|
|
return (int)((1.0 / fStepSize) + 0.5f); // round to nearest int
|
|
|
|
return (int)((1.0 / fStepSize) + 0.5f); // round to nearest int
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int plSimulationMgr::GetMaterialIdx(NxScene* scene, hsScalar friction, hsScalar restitution) |
|
|
|
int plSimulationMgr::GetMaterialIdx(NxScene* scene, hsScalar friction, hsScalar restitution) |
|
|
|