adding physics tick time to post simulate event (#1401)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user