Merge pull request #242 from aws-lumberyard-dev/physx_ragdoll_create
Ragdoll now uses Add/Remove SimulatedBody
This commit is contained in:
@@ -78,7 +78,7 @@ namespace Physics
|
||||
float m_minimumMovementDistance = 0.001f; //!< To avoid jittering, the controller will not attempt to move distances below this.
|
||||
float m_maximumSpeed = 100.0f; //!< If the accumulated requested velocity for a tick exceeds this magnitude, it will be clamped.
|
||||
AZStd::string m_colliderTag; //!< Used to identify the collider associated with the character controller.
|
||||
AZStd::shared_ptr<Physics::ShapeConfiguration> m_shapeConfig = nullptr; //!< The shape to use when creating the character controller.
|
||||
AZStd::shared_ptr<Physics::ShapeConfiguration> m_shapeConfig; //!< The shape to use when creating the character controller.
|
||||
AZStd::vector<AZStd::shared_ptr<Physics::Shape>> m_colliders; //!< The list of colliders to attach to the character controller.
|
||||
};
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace AzPhysics
|
||||
|
||||
//! Flag to determine if the body is part of the simulation.
|
||||
//! When true the body will be affected by any forces, collisions, and found with scene queries.
|
||||
bool m_simulating = true;
|
||||
bool m_simulating = false;
|
||||
|
||||
//! Helper functions for setting user data.
|
||||
//! @param userData Can be a pointer to any type as internally will be cast to a void*. Object lifetime not managed by the SimulatedBody.
|
||||
|
||||
+1
@@ -46,6 +46,7 @@ namespace AzPhysics
|
||||
->Field("orientation", &SimulatedBodyConfiguration::m_orientation)
|
||||
->Field("scale", &SimulatedBodyConfiguration::m_scale)
|
||||
->Field("entityId", &SimulatedBodyConfiguration::m_entityId)
|
||||
->Field("startSimulationEnabled", &SimulatedBodyConfiguration::m_startSimulationEnabled)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -39,6 +39,7 @@ namespace AzPhysics
|
||||
AZ::Vector3 m_position = AZ::Vector3::CreateZero();
|
||||
AZ::Quaternion m_orientation = AZ::Quaternion::CreateIdentity();
|
||||
AZ::Vector3 m_scale = AZ::Vector3::CreateOne();
|
||||
bool m_startSimulationEnabled = true;
|
||||
|
||||
// Entity/object association.
|
||||
AZ::EntityId m_entityId = AZ::EntityId(AZ::EntityId::InvalidEntityId);
|
||||
|
||||
@@ -52,6 +52,11 @@ namespace Physics
|
||||
}
|
||||
}
|
||||
|
||||
RagdollConfiguration::RagdollConfiguration()
|
||||
{
|
||||
m_startSimulationEnabled = false; //ragdolls do not start enabled.
|
||||
}
|
||||
|
||||
void RagdollConfiguration::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
namespace Physics
|
||||
{
|
||||
using ParentIndices = AZStd::vector<size_t>;
|
||||
|
||||
class RagdollNodeConfiguration
|
||||
: public AzPhysics::RigidBodyConfiguration
|
||||
{
|
||||
@@ -46,7 +48,7 @@ namespace Physics
|
||||
AZ_RTTI(RagdollConfiguration, "{7C96D332-61D8-4C58-A2BF-707716D38D14}", AzPhysics::SimulatedBodyConfiguration);
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
RagdollConfiguration() = default;
|
||||
RagdollConfiguration();
|
||||
explicit RagdollConfiguration(const RagdollConfiguration& settings) = default;
|
||||
|
||||
RagdollNodeConfiguration* FindNodeConfigByName(const AZStd::string& nodeName) const;
|
||||
@@ -56,6 +58,8 @@ namespace Physics
|
||||
|
||||
AZStd::vector<RagdollNodeConfiguration> m_nodes;
|
||||
CharacterColliderConfiguration m_colliders;
|
||||
RagdollState m_initialState;
|
||||
ParentIndices m_parentIndices;
|
||||
};
|
||||
|
||||
/// Represents a single rigid part of a ragdoll.
|
||||
@@ -79,7 +83,7 @@ namespace Physics
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(Ragdoll, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(Ragdoll, "{01F09602-80EC-4693-A0E7-C2719239044B}", AzPhysics::SimulatedBody);
|
||||
AZ_RTTI(Physics::Ragdoll, "{01F09602-80EC-4693-A0E7-C2719239044B}", AzPhysics::SimulatedBody);
|
||||
virtual ~Ragdoll() = default;
|
||||
|
||||
/// Inserts the ragdoll into the physics simulation.
|
||||
|
||||
Reference in New Issue
Block a user