mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 15:17:42 +02:00
Merge pull request #6241 from huffman/fix-physics-substep-warning
Fix warning in ThreadSafeDynamicsWorld
This commit is contained in:
commit
126f68114b
3 changed files with 9 additions and 6 deletions
|
@ -241,7 +241,7 @@ void PhysicsEngine::stepSimulation() {
|
||||||
float timeStep = btMin(dt, MAX_TIMESTEP);
|
float timeStep = btMin(dt, MAX_TIMESTEP);
|
||||||
|
|
||||||
if (_myAvatarController) {
|
if (_myAvatarController) {
|
||||||
// ADEBUG TODO: move this stuff outside and in front of stepSimulation, because
|
// ADEBUG TODO: move this stuff outside and in front of stepSimulation, because
|
||||||
// the updateShapeIfNecessary() call needs info from MyAvatar and should
|
// the updateShapeIfNecessary() call needs info from MyAvatar and should
|
||||||
// be done on the main thread during the pre-simulation stuff
|
// be done on the main thread during the pre-simulation stuff
|
||||||
if (_myAvatarController->needsRemoval()) {
|
if (_myAvatarController->needsRemoval()) {
|
||||||
|
@ -263,7 +263,8 @@ void PhysicsEngine::stepSimulation() {
|
||||||
updateContactMap();
|
updateContactMap();
|
||||||
};
|
};
|
||||||
|
|
||||||
int numSubsteps = _dynamicsWorld->stepSimulation(timeStep, PHYSICS_ENGINE_MAX_NUM_SUBSTEPS, PHYSICS_ENGINE_FIXED_SUBSTEP, onSubStep);
|
int numSubsteps = _dynamicsWorld->stepSimulationWithSubstepCallback(timeStep, PHYSICS_ENGINE_MAX_NUM_SUBSTEPS,
|
||||||
|
PHYSICS_ENGINE_FIXED_SUBSTEP, onSubStep);
|
||||||
if (numSubsteps > 0) {
|
if (numSubsteps > 0) {
|
||||||
BT_PROFILE("postSimulation");
|
BT_PROFILE("postSimulation");
|
||||||
_numSubsteps += (uint32_t)numSubsteps;
|
_numSubsteps += (uint32_t)numSubsteps;
|
||||||
|
|
|
@ -27,8 +27,9 @@ ThreadSafeDynamicsWorld::ThreadSafeDynamicsWorld(
|
||||||
: btDiscreteDynamicsWorld(dispatcher, pairCache, constraintSolver, collisionConfiguration) {
|
: btDiscreteDynamicsWorld(dispatcher, pairCache, constraintSolver, collisionConfiguration) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int ThreadSafeDynamicsWorld::stepSimulation( btScalar timeStep, int maxSubSteps, btScalar fixedTimeStep, SubStepCallback onSubStep) {
|
int ThreadSafeDynamicsWorld::stepSimulationWithSubstepCallback(btScalar timeStep, int maxSubSteps,
|
||||||
BT_PROFILE("stepSimulation");
|
btScalar fixedTimeStep, SubStepCallback onSubStep) {
|
||||||
|
BT_PROFILE("stepSimulationWithSubstepCallback");
|
||||||
int subSteps = 0;
|
int subSteps = 0;
|
||||||
if (maxSubSteps) {
|
if (maxSubSteps) {
|
||||||
//fixed timestep with interpolation
|
//fixed timestep with interpolation
|
||||||
|
|
|
@ -37,8 +37,9 @@ public:
|
||||||
btConstraintSolver* constraintSolver,
|
btConstraintSolver* constraintSolver,
|
||||||
btCollisionConfiguration* collisionConfiguration);
|
btCollisionConfiguration* collisionConfiguration);
|
||||||
|
|
||||||
// virtual overrides from btDiscreteDynamicsWorld
|
int stepSimulationWithSubstepCallback(btScalar timeStep, int maxSubSteps = 1,
|
||||||
int stepSimulation( btScalar timeStep, int maxSubSteps=1, btScalar fixedTimeStep=btScalar(1.)/btScalar(60.), SubStepCallback onSubStep = []() { });
|
btScalar fixedTimeStep = btScalar(1.)/btScalar(60.),
|
||||||
|
SubStepCallback onSubStep = []() { });
|
||||||
void synchronizeMotionStates();
|
void synchronizeMotionStates();
|
||||||
|
|
||||||
// btDiscreteDynamicsWorld::m_localTime is the portion of real-time that has not yet been simulated
|
// btDiscreteDynamicsWorld::m_localTime is the portion of real-time that has not yet been simulated
|
||||||
|
|
Loading…
Reference in a new issue