JoltPhysics3D: Add elapsedTime parameter to PostSimulate

This commit is contained in:
SirLynix 2023-12-07 16:45:46 +01:00
parent 6cbfb01243
commit 26dbdef50d
5 changed files with 8 additions and 8 deletions

View File

@ -82,7 +82,7 @@ namespace Nz
void Destroy(); void Destroy();
private: private:
void PostSimulate() override; void PostSimulate(float elapsedTime) override;
void PreSimulate(float elapsedTime) override; void PreSimulate(float elapsedTime) override;
std::shared_ptr<JoltCharacterImpl> m_impl; std::shared_ptr<JoltCharacterImpl> m_impl;
@ -100,7 +100,7 @@ namespace Nz
JoltCharacterImpl(JoltCharacterImpl&&) = delete; JoltCharacterImpl(JoltCharacterImpl&&) = delete;
virtual ~JoltCharacterImpl(); virtual ~JoltCharacterImpl();
virtual void PostSimulate(JoltCharacter& character); virtual void PostSimulate(JoltCharacter& character, float elapsedTime);
virtual void PreSimulate(JoltCharacter& character, float elapsedTime); virtual void PreSimulate(JoltCharacter& character, float elapsedTime);
JoltCharacterImpl& operator=(const JoltCharacterImpl&) = delete; JoltCharacterImpl& operator=(const JoltCharacterImpl&) = delete;

View File

@ -20,7 +20,7 @@ namespace Nz
JoltPhysicsStepListener(JoltPhysicsStepListener&&) = delete; JoltPhysicsStepListener(JoltPhysicsStepListener&&) = delete;
virtual ~JoltPhysicsStepListener(); virtual ~JoltPhysicsStepListener();
virtual void PostSimulate(); virtual void PostSimulate(float elapsedTime);
virtual void PreSimulate(float elapsedTime); virtual void PreSimulate(float elapsedTime);
JoltPhysicsStepListener& operator=(const JoltPhysicsStepListener&) = delete; JoltPhysicsStepListener& operator=(const JoltPhysicsStepListener&) = delete;

View File

@ -197,10 +197,10 @@ namespace Nz
m_collider.reset(); m_collider.reset();
} }
void JoltCharacter::PostSimulate() void JoltCharacter::PostSimulate(float elapsedTime)
{ {
m_character->PostSimulation(0.05f); m_character->PostSimulation(0.05f);
m_impl->PostSimulate(*this); m_impl->PostSimulate(*this, elapsedTime);
} }
void JoltCharacter::PreSimulate(float elapsedTime) void JoltCharacter::PreSimulate(float elapsedTime)
@ -211,7 +211,7 @@ namespace Nz
JoltCharacterImpl::~JoltCharacterImpl() = default; JoltCharacterImpl::~JoltCharacterImpl() = default;
void JoltCharacterImpl::PostSimulate(JoltCharacter& /*character*/) void JoltCharacterImpl::PostSimulate(JoltCharacter& /*character*/, float /*elapsedTime*/)
{ {
} }

View File

@ -473,7 +473,7 @@ namespace Nz
m_world->physicsSystem.Update(stepSize, 1, &m_world->tempAllocator, &jobSystem); m_world->physicsSystem.Update(stepSize, 1, &m_world->tempAllocator, &jobSystem);
for (JoltPhysicsStepListener* stepListener : m_stepListeners) for (JoltPhysicsStepListener* stepListener : m_stepListeners)
stepListener->PostSimulate(); stepListener->PostSimulate(stepSize);
m_timestepAccumulator -= m_stepSize; m_timestepAccumulator -= m_stepSize;
stepCount++; stepCount++;

View File

@ -9,7 +9,7 @@ namespace Nz
{ {
JoltPhysicsStepListener::~JoltPhysicsStepListener() = default; JoltPhysicsStepListener::~JoltPhysicsStepListener() = default;
void JoltPhysicsStepListener::PostSimulate() void JoltPhysicsStepListener::PostSimulate(float /*elapsedTime*/)
{ {
} }