Remove physics world body notification bus (#576)
This commit is contained in:
+13
-28
@@ -19,44 +19,29 @@
|
||||
|
||||
namespace AzPhysics
|
||||
{
|
||||
struct SimulatedBody;
|
||||
}
|
||||
|
||||
namespace Physics
|
||||
{
|
||||
//! Requests for generic physical world bodies
|
||||
class WorldBodyRequests
|
||||
//! Requests for physics simulated body components.
|
||||
class SimulatedBodyComponentRequests
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
using MutexType = AZStd::recursive_mutex;
|
||||
|
||||
//! Enable physics for this body
|
||||
//! Enable physics for this body.
|
||||
virtual void EnablePhysics() = 0;
|
||||
//! Disable physics for this body
|
||||
//! Disable physics for this body.
|
||||
virtual void DisablePhysics() = 0;
|
||||
//! Retrieve whether physics is enabled for this body
|
||||
//! Retrieve whether physics is enabled for this body.
|
||||
virtual bool IsPhysicsEnabled() const = 0;
|
||||
|
||||
//! Retrieves the AABB(aligned-axis bounding box) for this body
|
||||
//! Retrieves the AABB(aligned-axis bounding box) for this body.
|
||||
virtual AZ::Aabb GetAabb() const = 0;
|
||||
//! Retrieves current WorldBody* for this body. Note: Do not hold a reference to AzPhysics::SimulatedBody* as could be deleted
|
||||
virtual AzPhysics::SimulatedBody* GetWorldBody() = 0;
|
||||
|
||||
//! Perform a single-object raycast against this body
|
||||
//! Get the Simulated Body Handle for this body.
|
||||
virtual AzPhysics::SimulatedBodyHandle GetSimulatedBodyHandle() const = 0;
|
||||
//! Retrieves current WorldBody* for this body.
|
||||
//! @note Do not hold a reference to AzPhysics::SimulatedBody* as it could be deleted or moved.
|
||||
virtual AzPhysics::SimulatedBody* GetSimulatedBody() = 0;
|
||||
//! Perform a single-object raycast against this body.
|
||||
virtual AzPhysics::SceneQueryHit RayCast(const AzPhysics::RayCastRequest& request) = 0;
|
||||
};
|
||||
using WorldBodyRequestBus = AZ::EBus<WorldBodyRequests>;
|
||||
|
||||
//! Notifications for generic physical world bodies
|
||||
class WorldBodyNotifications
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
//! Notification for physics enabled
|
||||
virtual void OnPhysicsEnabled() = 0;
|
||||
//! Notification for physics disabled
|
||||
virtual void OnPhysicsDisabled() = 0;
|
||||
};
|
||||
using WorldBodyNotificationBus = AZ::EBus<WorldBodyNotifications>;
|
||||
using SimulatedBodyComponentRequestsBus = AZ::EBus<SimulatedBodyComponentRequests>;
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <AzFramework/Physics/ShapeConfiguration.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzFramework/Physics/CollisionBus.h>
|
||||
#include <AzFramework/Physics/WorldBodyBus.h>
|
||||
#include <AzFramework/Physics/Components/SimulatedBodyComponentBus.h>
|
||||
#include <AzFramework/Physics/WindBus.h>
|
||||
#include <AzFramework/Physics/PhysicsSystem.h>
|
||||
#include <AzFramework/Physics/Collision/CollisionEvents.h>
|
||||
@@ -39,19 +39,19 @@ namespace Physics
|
||||
{
|
||||
namespace ReflectionUtils
|
||||
{
|
||||
void ReflectWorldBodyBus(AZ::ReflectContext* context)
|
||||
void ReflectSimulatedBodyComponentRequestsBus(AZ::ReflectContext* context)
|
||||
{
|
||||
if (auto* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
||||
{
|
||||
behaviorContext->EBus<Physics::WorldBodyRequestBus>("WorldBodyRequestBus")
|
||||
behaviorContext->EBus<AzPhysics::SimulatedBodyComponentRequestsBus>("SimulatedBodyComponentRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
|
||||
->Attribute(AZ::Script::Attributes::Module, "physics")
|
||||
->Attribute(AZ::Script::Attributes::Category, "PhysX")
|
||||
->Event("EnablePhysics", &WorldBodyRequests::EnablePhysics)
|
||||
->Event("DisablePhysics", &WorldBodyRequests::DisablePhysics)
|
||||
->Event("IsPhysicsEnabled", &WorldBodyRequests::IsPhysicsEnabled)
|
||||
->Event("GetAabb", &WorldBodyRequests::GetAabb)
|
||||
->Event("RayCast", &WorldBodyRequests::RayCast)
|
||||
->Event("EnablePhysics", &AzPhysics::SimulatedBodyComponentRequests::EnablePhysics)
|
||||
->Event("DisablePhysics", &AzPhysics::SimulatedBodyComponentRequests::DisablePhysics)
|
||||
->Event("IsPhysicsEnabled", &AzPhysics::SimulatedBodyComponentRequests::IsPhysicsEnabled)
|
||||
->Event("GetAabb", &AzPhysics::SimulatedBodyComponentRequests::GetAabb)
|
||||
->Event("RayCast", &AzPhysics::SimulatedBodyComponentRequests::RayCast)
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -131,7 +131,7 @@ namespace Physics
|
||||
AnimationConfiguration::Reflect(context);
|
||||
CharacterConfiguration::Reflect(context);
|
||||
AzPhysics::SimulatedBody::Reflect(context);
|
||||
ReflectWorldBodyBus(context);
|
||||
ReflectSimulatedBodyComponentRequestsBus(context);
|
||||
CollisionFilteringRequests::Reflect(context);
|
||||
AzPhysics::SceneQuery::ReflectSceneQueryObjects(context);
|
||||
ReflectWindBus(context);
|
||||
|
||||
@@ -213,6 +213,12 @@ set(FILES
|
||||
StreamingInstall/StreamingInstall.cpp
|
||||
StreamingInstall/StreamingInstallRequests.h
|
||||
StreamingInstall/StreamingInstallNotifications.h
|
||||
Physics/Collision/CollisionEvents.h
|
||||
Physics/Collision/CollisionEvents.cpp
|
||||
Physics/Collision/CollisionLayers.h
|
||||
Physics/Collision/CollisionLayers.cpp
|
||||
Physics/Collision/CollisionGroups.h
|
||||
Physics/Collision/CollisionGroups.cpp
|
||||
Physics/Common/PhysicsSceneQueries.h
|
||||
Physics/Common/PhysicsSceneQueries.cpp
|
||||
Physics/Common/PhysicsEvents.h
|
||||
@@ -223,12 +229,7 @@ set(FILES
|
||||
Physics/Common/PhysicsSimulatedBodyEvents.h
|
||||
Physics/Common/PhysicsSimulatedBodyEvents.cpp
|
||||
Physics/Common/PhysicsTypes.h
|
||||
Physics/Collision/CollisionEvents.h
|
||||
Physics/Collision/CollisionEvents.cpp
|
||||
Physics/Collision/CollisionLayers.h
|
||||
Physics/Collision/CollisionLayers.cpp
|
||||
Physics/Collision/CollisionGroups.h
|
||||
Physics/Collision/CollisionGroups.cpp
|
||||
Physics/Components/SimulatedBodyComponentBus.h
|
||||
Physics/Configuration/CollisionConfiguration.h
|
||||
Physics/Configuration/CollisionConfiguration.cpp
|
||||
Physics/Configuration/RigidBodyConfiguration.h
|
||||
@@ -265,7 +266,6 @@ set(FILES
|
||||
Physics/ShapeConfiguration.h
|
||||
Physics/ShapeConfiguration.cpp
|
||||
Physics/SystemBus.h
|
||||
Physics/WorldBodyBus.h
|
||||
Physics/ColliderComponentBus.h
|
||||
Physics/RagdollPhysicsBus.h
|
||||
Physics/CharacterPhysicsDataBus.h
|
||||
|
||||
Reference in New Issue
Block a user