#include <PhysicsSystem.h>
|
static void | Reflect (AZ::ReflectContext *context) |
|
|
SystemEvents::OnInitializedEvent | m_initializeEvent |
|
SystemEvents::OnReinitializedEvent | m_reinitializeEvent |
|
SystemEvents::OnShutdownEvent | m_shutdownEvent |
|
SystemEvents::OnPresimulateEvent | m_preSimulateEvent |
|
SystemEvents::OnPostsimulateEvent | m_postSimulateEvent |
|
SystemEvents::OnSceneAddedEvent | m_sceneAddedEvent |
|
SystemEvents::OnSceneRemovedEvent | m_sceneRemovedEvent |
|
SystemEvents::OnConfigurationChangedEvent | m_configChangeEvent |
|
SystemEvents::OnDefaultSceneConfigurationChangedEvent | m_onDefaultSceneConfigurationChangedEvent |
|
Interface to access the Physics System.
◆ AddScene()
virtual SceneHandle AzPhysics::SystemInterface::AddScene |
( |
const SceneConfiguration & |
config | ) |
|
|
pure virtual |
Add a scene to the physics simulation.
- Parameters
-
config | This is the Configuration of the scene to add. |
- Returns
- Returns a SceneHandle of the Scene created or InvalidSceneHandle if it fails.
◆ AddScenes()
virtual SceneHandleList AzPhysics::SystemInterface::AddScenes |
( |
const SceneConfigurationList & |
configs | ) |
|
|
pure virtual |
Add multiple scenes to the physics simulation.
- Parameters
-
- Returns
- Returns a list of SceneHandle objects for each created Scene. Order will be the same as the SceneConfigurationList provided.
◆ FindAttachedBodyHandleFromEntityId()
virtual AZStd::pair<SceneHandle, SimulatedBodyHandle> AzPhysics::SystemInterface::FindAttachedBodyHandleFromEntityId |
( |
AZ::EntityId |
entityId | ) |
|
|
pure virtual |
Helper to find the SceneHandle and SimulatedBodyHandle of a body related to the requested EntityId.
- Note
- This will search all scenes and maybe slow if there are many Scenes.
- Parameters
-
entityId | The entity to search for. |
- Returns
- Will return a AZStd::pair of SceneHandle and SimulatedBodyHandle of the requested entityid, otherwise will return AzPhysics::InvalidSceneHandle, AzPhysics::SimulatedBodyHandle.
◆ GetAllScenes()
virtual SceneList& AzPhysics::SystemInterface::GetAllScenes |
( |
| ) |
|
|
pure virtual |
Retrieve all current Scenes.
- Returns
- Returns a list of SceneInterface pointers.
◆ GetScene()
virtual Scene* AzPhysics::SystemInterface::GetScene |
( |
SceneHandle |
handle | ) |
|
|
pure virtual |
Get the Scene of the requested SceneHandle.
- Parameters
-
handle | The SceneHandle of the requested scene. |
- Returns
- Returns a Scene pointer if found, otherwise nullptr.
◆ GetSceneHandle()
virtual SceneHandle AzPhysics::SystemInterface::GetSceneHandle |
( |
const AZStd::string & |
sceneName | ) |
|
|
pure virtual |
Returns a Scene Handle connected to the given scene name.
- Parameters
-
sceneName | The name of the scene to look up. |
- Returns
- Will return a SceneHandle to a Scene connected with the given name, otherwise will return InvalidSceneHandle.
◆ GetScenes()
virtual SceneList AzPhysics::SystemInterface::GetScenes |
( |
const SceneHandleList & |
handles | ) |
|
|
pure virtual |
Get multiple Scenes.
- Parameters
-
handles | A list of SceneHandle objects to retrieve. |
- Returns
- Returns a list of SceneInterface pointers. The order is the same as supplied. Pointer may be null if not a valid SceneHandle.
◆ Initialize()
Initialize the Physics system with the given configuration.
- Parameters
-
config | Contains the configuration options |
◆ RegisterOnDefaultSceneConfigurationChangedEventHandler()
void AzPhysics::SystemInterface::RegisterOnDefaultSceneConfigurationChangedEventHandler |
( |
SystemEvents::OnDefaultSceneConfigurationChangedEvent::Handler & |
handler | ) |
|
|
inline |
Register a handler to receive an event when the default SceneConfiguration changes.
- Parameters
-
handler | The handler to receive the event. |
◆ RegisterPostSimulateEvent()
void AzPhysics::SystemInterface::RegisterPostSimulateEvent |
( |
SystemEvents::OnPostsimulateEvent::Handler & |
handler | ) |
|
|
inline |
Register to receive notifications when the Physics System simulation ends.
- Parameters
-
handler | The handler to receive the event. |
◆ RegisterPreSimulateEvent()
void AzPhysics::SystemInterface::RegisterPreSimulateEvent |
( |
SystemEvents::OnPresimulateEvent::Handler & |
handler | ) |
|
|
inline |
Register to receive notifications when the Physics System simulation begins.
- Parameters
-
handler | The handler to receive the event. |
◆ RegisterSceneAddedEvent()
void AzPhysics::SystemInterface::RegisterSceneAddedEvent |
( |
SystemEvents::OnSceneAddedEvent::Handler & |
handler | ) |
|
|
inline |
Register to receive notifications when the a new Scene is added to the simulation.
- Parameters
-
handler | The handler to receive the event. |
◆ RegisterSceneRemovedEvent()
void AzPhysics::SystemInterface::RegisterSceneRemovedEvent |
( |
SystemEvents::OnSceneRemovedEvent::Handler & |
handler | ) |
|
|
inline |
Register to receive notifications when the a Scene is removed from the simulation.
- Parameters
-
handler | The handler to receive the event. |
◆ RegisterSystemConfigurationChangedEvent()
void AzPhysics::SystemInterface::RegisterSystemConfigurationChangedEvent |
( |
SystemEvents::OnConfigurationChangedEvent::Handler & |
handler | ) |
|
|
inline |
Register to receive notifications when the SystemConfiguration changes.
- Parameters
-
handler | The handler to receive the event. |
◆ RegisterSystemInitializedEvent()
void AzPhysics::SystemInterface::RegisterSystemInitializedEvent |
( |
SystemEvents::OnInitializedEvent::Handler & |
handler | ) |
|
|
inline |
Register to receive notifications when the Physics System is Initialized.
- Parameters
-
handler | The handler to receive the event. |
◆ RegisterSystemReInitializedEvent()
void AzPhysics::SystemInterface::RegisterSystemReInitializedEvent |
( |
SystemEvents::OnReinitializedEvent::Handler & |
handler | ) |
|
|
inline |
Register to receive notifications when the Physics System is reinitialized.
- Parameters
-
handler | The handler to receive the event. |
◆ RegisterSystemShutdownEvent()
void AzPhysics::SystemInterface::RegisterSystemShutdownEvent |
( |
SystemEvents::OnShutdownEvent::Handler & |
handler | ) |
|
|
inline |
Register to receive notifications when the Physics System shuts down.
- Parameters
-
handler | The handler to receive the event. |
◆ Reinitialize()
virtual void AzPhysics::SystemInterface::Reinitialize |
( |
| ) |
|
|
pure virtual |
Will re-initialize the physics backend. Will preserve Scene and Simulation Body data along with any existing Handles.
◆ RemoveScene()
virtual void AzPhysics::SystemInterface::RemoveScene |
( |
SceneHandle |
handle | ) |
|
|
pure virtual |
Remove the requested Scene if it exists.
- Parameters
-
handle | The handle to the scene to remove. |
◆ RemoveScenes()
virtual void AzPhysics::SystemInterface::RemoveScenes |
( |
const SceneHandleList & |
handles | ) |
|
|
pure virtual |
Remove many Scenes if they exist.
- Parameters
-
handles | A list of handles to each scene to remove. |
◆ Shutdown()
virtual void AzPhysics::SystemInterface::Shutdown |
( |
| ) |
|
|
pure virtual |
Teardown the whole Physics system. This removes all Scene and Simulation Body data, then physics will stop running.
◆ Simulate()
virtual void AzPhysics::SystemInterface::Simulate |
( |
float |
deltaTime | ) |
|
|
pure virtual |
Advance the Physics state. This will iterate the Scene list, update All simulation bodies and advance the physics state by the given delta time. It is recommended to call this function to run the physics tick. Advanced users may manually update each scene, if required to have finer control. This function will also signal the OnPresimulateEvent and OnPostsimulateEvent. The OnPresimulateEvent will have a parameter that will be the total time executed by the simulation. When SystemConfiguration::m_fixedTimestep is greater than zero, the simulation will run at the fixed time step and may run multiple steps per frame. This time can range from 0.0f to SystemConfiguration::m_maxTimestep. Where 0.0 time indicates that the simulation did not execute any steps this frame. When SystemConfiguration::m_fixedTimestep equal to or less than zero, the simulation will step once with a time between deltaTime and SystemConfiguration::m_maxTimestep. Example Advanced users might do to self manage Advancing the physics state.
{
SceneInterfaceList& sceneList = system->GetAllScenes();
for(auto scene : sceneList)
{
scene->StartSimulation(deltatime);
scene->FinishSimulation();
}
}
Definition: IRemoteTools.h:32
- Parameters
-
deltaTime | This is the time in seconds to simulate physics for this tick (60fps = 0.01666667). Typically the frame deltaTime of the game loop. |
◆ UpdateConfiguration()
virtual void AzPhysics::SystemInterface::UpdateConfiguration |
( |
const SystemConfiguration * |
newConfig, |
|
|
bool |
forceReinitialization = false |
|
) |
| |
|
pure virtual |
Update the SystemConfiguration. This will apply the new configuration, some properties may require the reinitialization of the physics system and will tear down all Scenes and Simulation bodies.
- Parameters
-
newConfig | The new configuration to apply. |
forceReinitialization | Flag to force a reinitialization of the physics system. Default false. |
◆ UpdateDefaultSceneConfiguration()
virtual void AzPhysics::SystemInterface::UpdateDefaultSceneConfiguration |
( |
const SceneConfiguration & |
sceneConfiguration | ) |
|
|
pure virtual |
Update the current default scene configuration. This is the configuration used to to create scenes without a custom configuration.
- Parameters
-
sceneConfiguration | The new configuration to apply. |
The documentation for this class was generated from the following file:
- Code/Framework/AzFramework/AzFramework/Physics/PhysicsSystem.h