adding physics tick time to post simulate event (#1401)

This commit is contained in:
amzn-sean
2021-06-18 14:09:34 +01:00
committed by GitHub
parent 108b6f8e0c
commit b17c5ca3e6
4 changed files with 6 additions and 4 deletions
@@ -48,7 +48,8 @@ namespace AzPhysics
using OnPresimulateEvent = AZ::Event<float>;
//! Event triggers at the end of the SystemInterface::Simulate call.
using OnPostsimulateEvent = AZ::Event<>;
//! Parameter is the total time that the physics system will run for during the Simulate call.
using OnPostsimulateEvent = AZ::Event<float>;
//! Event trigger when a Scene is added to the simulation.
//! When triggered will send the handle to the new Scene.
@@ -43,7 +43,7 @@ namespace AzPhysics
const AZ::BehaviorAzEventDescription postsimulateEventDescription =
{
"Postsimulate event",
{} // Parameters
{"Tick time"} // Parameters
};
behaviorContext->Class<SystemInterface>("System Interface")
@@ -198,7 +198,7 @@ namespace PhysX
simulateScenes(tickTime);
}
m_postSimulateEvent.Signal();
m_postSimulateEvent.Signal(tickTime);
}
AzPhysics::SceneHandle PhysXSystem::AddScene(const AzPhysics::SceneConfiguration& config)
+2 -1
View File
@@ -219,8 +219,9 @@ namespace PhysX
preSimEventCount++;
});
AzPhysics::SystemEvents::OnPostsimulateEvent::Handler postSimEvent(
[&postSimEventCount]()
[&expectedTickTime, &postSimEventCount](float deltaTime)
{
EXPECT_NEAR(expectedTickTime, deltaTime, 0.001f);
postSimEventCount++;
});
physicsSystem->RegisterPreSimulateEvent(preSimEvent);