|
@@ -518,7 +518,7 @@ namespace BansheeEngine
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- float simulationAmount = curFrameTime - mLastSimulationTime;
|
|
|
|
|
|
|
+ float simulationAmount = std::max(curFrameTime - mLastSimulationTime, mSimulationStep); // At least one step
|
|
|
INT32 numIterations = Math::floorToInt(simulationAmount / mSimulationStep);
|
|
INT32 numIterations = Math::floorToInt(simulationAmount / mSimulationStep);
|
|
|
|
|
|
|
|
// If too many iterations are required, increase time step. This should only happen in extreme situations (or when
|
|
// If too many iterations are required, increase time step. This should only happen in extreme situations (or when
|
|
@@ -538,6 +538,7 @@ namespace BansheeEngine
|
|
|
|
|
|
|
|
mScene->simulate(step, nullptr, scratchBuffer, SCRATCH_BUFFER_SIZE);
|
|
mScene->simulate(step, nullptr, scratchBuffer, SCRATCH_BUFFER_SIZE);
|
|
|
simulationAmount -= step;
|
|
simulationAmount -= step;
|
|
|
|
|
+ mLastSimulationTime += step;
|
|
|
|
|
|
|
|
UINT32 errorState;
|
|
UINT32 errorState;
|
|
|
if(!mScene->fetchResults(true, &errorState))
|
|
if(!mScene->fetchResults(true, &errorState))
|
|
@@ -557,6 +558,12 @@ namespace BansheeEngine
|
|
|
iterationCount++;
|
|
iterationCount++;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if(iterationCount == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ LOGWRN(toString(step) + " - " + toString(mSimulationStep) + " - " +
|
|
|
|
|
+ toString(numIterations) + " - " + toString(curFrameTime) + " - " + toString(mLastSimulationTime) + " - " + toString(nextFrameTime));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// Update rigidbodies with new transforms
|
|
// Update rigidbodies with new transforms
|
|
|
PxU32 numActiveTransforms;
|
|
PxU32 numActiveTransforms;
|
|
|
const PxActiveTransform* activeTransforms = mScene->getActiveTransforms(numActiveTransforms);
|
|
const PxActiveTransform* activeTransforms = mScene->getActiveTransforms(numActiveTransforms);
|
|
@@ -580,7 +587,6 @@ namespace BansheeEngine
|
|
|
|
|
|
|
|
// TODO - Consider extrapolating for the remaining "simulationAmount" value
|
|
// TODO - Consider extrapolating for the remaining "simulationAmount" value
|
|
|
|
|
|
|
|
- mLastSimulationTime = curFrameTime;
|
|
|
|
|
mUpdateInProgress = false;
|
|
mUpdateInProgress = false;
|
|
|
|
|
|
|
|
triggerEvents();
|
|
triggerEvents();
|
|
@@ -699,12 +705,12 @@ namespace BansheeEngine
|
|
|
|
|
|
|
|
SPtr<PhysicsMaterial> PhysX::createMaterial(float staticFriction, float dynamicFriction, float restitution)
|
|
SPtr<PhysicsMaterial> PhysX::createMaterial(float staticFriction, float dynamicFriction, float restitution)
|
|
|
{
|
|
{
|
|
|
- return bs_shared_ptr_new<PhysXMaterial>(mPhysics, staticFriction, dynamicFriction, restitution);
|
|
|
|
|
|
|
+ return bs_core_ptr_new<PhysXMaterial>(mPhysics, staticFriction, dynamicFriction, restitution);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
SPtr<PhysicsMesh> PhysX::createMesh(const MeshDataPtr& meshData, PhysicsMeshType type)
|
|
SPtr<PhysicsMesh> PhysX::createMesh(const MeshDataPtr& meshData, PhysicsMeshType type)
|
|
|
{
|
|
{
|
|
|
- return bs_shared_ptr_new<PhysXMesh>(meshData, type);
|
|
|
|
|
|
|
+ return bs_core_ptr_new<PhysXMesh>(meshData, type);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
SPtr<Rigidbody> PhysX::createRigidbody(const HSceneObject& linkedSO)
|
|
SPtr<Rigidbody> PhysX::createRigidbody(const HSceneObject& linkedSO)
|