3#include <Core/ResourceManager/ResourceHandle.h>
4#include <Core/World/ComponentManager.h>
5#include <Foundation/Math/Declarations.h>
6#include <JoltPlugin/JoltPluginDLL.h>
21 class RagdollSettings;
46 using StorageType = plUInt8;
82 virtual void SerializeComponent(
plWorldWriter& inout_stream)
const override;
83 virtual void DeserializeComponent(
plWorldReader& inout_stream)
override;
87 virtual void OnDeactivated()
override;
102 void SetGravityFactor(
float fFactor);
103 float GetGravityFactor()
const {
return m_fGravityFactor; }
109 bool m_bSelfCollision =
false;
112 float m_fStiffnessFactor = 1.0f;
115 float m_fMass = 50.0f;
140 void SetInitialImpulse(
const plVec3& vPosition,
const plVec3& vDirectionAndStrength);
143 void AddInitialImpulse(
const plVec3& vPosition,
const plVec3& vDirectionAndStrength);
146 float m_fOwnerVelocityScale = 1.0f;
152 float m_fCenterVelocity = 0.0f;
155 float m_fCenterAngularVelocity = 0.0f;
178 float m_fGravityFactor = 1.0f;
182 plUInt16 m_uiPartIndex = plInvalidJointIndex;
188 plUInt16 m_uiJoltPartIndex = plInvalidJointIndex;
191 void Update(
bool bForce);
193 void CreateLimbsFromBindPose();
194 void CreateLimbsFromCurrentMeshPose();
195 void DestroyAllLimbs();
197 bool HasCreatedLimbs()
const;
199 void UpdateOwnerPosition();
200 void RetrieveRagdollPose();
201 void SendAnimationPoseMsg();
202 void ConfigureRagdollPart(
void* pRagdollSettingsPart,
const plTransform& globalTransform, plUInt8 uiCollisionLayer,
plJoltWorldModule& worldModule);
209 virtual void ApplyPartInitialVelocity();
210 void ApplyBodyMass();
216 plUInt32 m_uiObjectFilterID = plInvalidIndex;
217 plUInt32 m_uiJoltUserDataIndex = plInvalidIndex;
220 JPH::Ragdoll* m_pRagdoll =
nullptr;
221 JPH::RagdollSettings* m_pRagdollSettings =
nullptr;
228 plUInt8 m_uiNumInitialImpulses = 0;
233 bool m_bOverrideType =
false;
242 void CreateLimbJoint(
const plSkeletonJoint& thisJoint,
void* pParentBodyDesc,
void* pThisBodyDesc);
This class encapsulates an array and it's size. It is recommended to use this class instead of plain ...
Definition ArrayPtr.h:37
Base class of all component types.
Definition Component.h:25
Definition ComponentManager.h:88
Definition DynamicArray.h:81
Definition JoltMaterial.h:7
Creates a physics ragdoll for an animated mesh and creates animation poses from the physics simulatio...
Definition JoltRagdollComponent.h:75
plUInt32 GetObjectFilterID() const
Returns the object ID used for all bodies in the ragdoll. This can be used to ignore the entire ragdo...
Definition JoltRagdollComponent.h:97
Definition JoltRagdollComponent.h:29
Definition JoltUserData.h:18
Definition JoltWorldModule.h:29
Describes a single joint. The transforms of the joints are in their local space and thus need to be c...
Definition Skeleton.h:27
Definition SkeletonResource.h:47
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
A class to use together with plHashedString for quick comparisons with temporary strings that need no...
Definition HashedString.h:151
static plVec3Template< float > MakeZero()
Definition Vec3.h:38
A world encapsulates a scene graph of game objects and various component managers and their component...
Definition World.h:22
virtual void OnSimulationStarted()
This method is called at the start of the next world update when the world is simulated....
Definition WorldModule.h:105
virtual void Initialize()
This method is called after the constructor. A derived type can override this method to do initializa...
Definition WorldModule.h:98
Reads a world description from a stream. Allows to instantiate that world multiple times in different...
Definition WorldReader.h:47
Stores an entire plWorld in a stream.
Definition WorldWriter.h:13
A custom enum implementation that allows to define the underlying storage type to control its memory ...
Definition Enum.h:37
Definition JoltRagdollComponent.h:231
Definition JoltRagdollComponent.h:186
Definition JoltRagdollComponent.h:181
With which pose a ragdoll should start.
Definition JoltRagdollComponent.h:45
Enum
Definition JoltRagdollComponent.h:49
@ WithNextAnimPose
The ragdoll waits for a new pose and then starts simulating with that.
Definition JoltRagdollComponent.h:51
@ WithBindPose
The ragdoll uses the bind pose (or rest pose) to start with.
Definition JoltRagdollComponent.h:50
@ WithCurrentMeshPose
The ragdoll retrieves the current pose from the animated mesh and starts simulating with that.
Definition JoltRagdollComponent.h:52
Used by components that skin a mesh to inform children whenever a new pose has been computed.
Definition Declarations.h:68
Used to apply a physical force on the object.
Definition PhysicsWorldModule.h:201
Used to apply a physical impulse on the object.
Definition PhysicsWorldModule.h:187
Queries the local transforms of each bone in an object with a skeleton.
Definition Declarations.h:122
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54
Definition SkeletonResource.h:12
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12
PL_ALWAYS_INLINE static constexpr plTime MakeZero()
Creates an instance of plTime that was initialized with zero.
Definition Time.h:42
Definition WorldModule.h:33