PixelLightAPI  .
Public Types | Public Member Functions | Protected Member Functions
PLPhysics::SNRagdoll Class Reference

Ragdoll scene node. More...

#include <SNRagdoll.h>

Inheritance diagram for PLPhysics::SNRagdoll:
Inheritance graph
[legend]

List of all members.

Public Types

enum  EDebugFlags { DebugNoPhysicsBodies = 1<<18 }
 Scene node debug flags (SceneNode debug flags extension) More...

Public Member Functions

PLPHYSICS_API bool GetAttachToWorldEnabled () const
PLPHYSICS_API void SetAttachToWorldEnabled (bool bValue)
PLPHYSICS_API bool GetAutoFreeze () const
PLPHYSICS_API void SetAutoFreeze (bool bValue)
PLPHYSICS_API bool GetUseGravity () const
PLPHYSICS_API void SetUseGravity (bool bValue)
PLPHYSICS_API SNRagdoll ()
 Default constructor.
virtual PLPHYSICS_API ~SNRagdoll ()
 Destructor.
PLPHYSICS_API SCPhysicsWorldGetWorldContainer () const
 Returns the PL physics world scene node container the ragdoll is in.
PLPHYSICS_API void ClearRagdoll ()
 Clears the radgoll.
PLPHYSICS_API bool CreateRagdoll (PLMesh::SkeletonHandler *pSkeletonHandler=nullptr)
 Creates the ragdoll using a skeleton handler.
PLPHYSICS_API void CreatePhysics (bool bAllowAttachToWorld=true)
 Creates the physics.
PLPHYSICS_API void CreatePhysicsBodies ()
 Creates the physics bodies.
PLPHYSICS_API void CreatePhysicsJoints (bool bAllowAttachToWorld=true)
 Creates the physics joints.
PLPHYSICS_API void CreatePhysicsRagdoll (bool bAllowAttachToWorld=true)
 Creates the physics ragdoll.
PLPHYSICS_API PLMesh::SkeletonGetSkeleton () const
 Returns the ragdoll skeleton.
PLPHYSICS_API bool IsEnabled () const
 Returns whether the ragdoll is enabled or not.
PLPHYSICS_API void SetEnabled (bool bEnabled=true)
 Enables/disables all bodies and joints.
PLPHYSICS_API PLCore::uint32 GetNumOfBodies () const
 Returns the number of bodies.
PLPHYSICS_API RagdollBodyGetBody (PLCore::uint32 nIndex) const
 Returns a body.
PLPHYSICS_API RagdollBodyGetBody (const PLCore::String &sName) const
 Returns a body.
PLPHYSICS_API RagdollBodyAddBody (const PLCore::String &sName="Joint", bool bCreatePhysics=true)
 Adds a new body.
PLPHYSICS_API RagdollBodyCloneBody (PLCore::uint32 nIndex, bool bCreatePhysics=true)
 Clones a body.
PLPHYSICS_API bool RemoveBody (PLCore::uint32 nIndex)
 Removes a body.
PLPHYSICS_API bool RemoveBodyAndJoint (PLCore::uint32 nIndex)
 Removes a body and the joint attached to it.
PLPHYSICS_API PLCore::uint32 GetNumOfJoints () const
 Returns the number of joints.
PLPHYSICS_API RagdollJointGetJoint (PLCore::uint32 nIndex) const
 Returns a joint.
PLPHYSICS_API RagdollJointGetJoint (const PLCore::String &sName) const
 Returns a joint.
PLPHYSICS_API RagdollJointAddJoint (const PLCore::String &sName="Joint", bool bCreatePhysics=true)
 Adds a new joint.
PLPHYSICS_API RagdollJointCloneJoint (PLCore::uint32 nIndex, bool bCreatePhysics=true)
 Clones a joint.
PLPHYSICS_API bool RemoveJoint (PLCore::uint32 nIndex)
 Removes a joint.
PLPHYSICS_API PLCore::uint32 GetNumOfNoCollisions () const
 Returns the number of no collisions.
PLPHYSICS_API NoCollisionAddNoCollision ()
 Adds a new no collision.
PLPHYSICS_API NoCollisionGetNoCollision (PLCore::uint32 nIndex) const
 Returns a no collision.
PLPHYSICS_API bool RemoveNoCollision (PLCore::uint32 nIndex)
 Removes a no collision.
PLPHYSICS_API PLCore::uint32 GetNumOfControllers () const
 Returns the number of controllers.
PLPHYSICS_API JointControllerAddController (const PLCore::String &sJointName)
 Adds a new controller.
PLPHYSICS_API JointControllerGetController (PLCore::uint32 nIndex) const
 Returns a controller.
PLPHYSICS_API JointControllerGetController (const PLCore::String &sName) const
 Returns a controller.
PLPHYSICS_API bool RemoveController (PLCore::uint32 nIndex)
 Removes a controller.
virtual PLPHYSICS_API void DrawDebug (PLRenderer::Renderer &cRenderer, const PLScene::VisNode *pVisNode=nullptr) override
 This function is called when the debug parts of the scene are drawn.
virtual PLPHYSICS_API bool Unload () override
 Unloads the loadable.
virtual PLPHYSICS_API
PLCore::String 
GetLoadableTypeName () const override
 Returns the loadable type name.

Protected Member Functions

virtual PLPHYSICS_API void InitFunction () override
 This function is called when the scene node gets initialized.
virtual PLPHYSICS_API void DeInitFunction () override
 This function is called when the scene node gets de-initialized.
virtual PLPHYSICS_API void OnActivate (bool bActivate) override
 Called when the scene node has been activated or deactivated.
virtual PLPHYSICS_API bool CallLoadable (PLCore::File &cFile, PLCore::Loader &cLoader, const PLCore::String &sMethod, const PLCore::String &sParams) override
 Calls the loadable in order to load or save.

Detailed Description

Ragdoll scene node.

Remarks:
The ragdoll (other names are 'online animation', 'articulated') scene node is an extension of SNMesh and allows the skeleton of the mesh to be influenced by a physics simulation.

Member Enumeration Documentation

Scene node debug flags (SceneNode debug flags extension)

Enumerator:
DebugNoPhysicsBodies 

Do not draw the physics bodies of the ragdoll


Constructor & Destructor Documentation

Default constructor.

virtual PLPHYSICS_API PLPhysics::SNRagdoll::~SNRagdoll ( ) [virtual]

Destructor.


Member Function Documentation

PLPHYSICS_API bool PLPhysics::SNRagdoll::GetAttachToWorldEnabled ( ) const
PLPHYSICS_API void PLPhysics::SNRagdoll::SetAttachToWorldEnabled ( bool  bValue)
PLPHYSICS_API bool PLPhysics::SNRagdoll::GetAutoFreeze ( ) const
PLPHYSICS_API void PLPhysics::SNRagdoll::SetAutoFreeze ( bool  bValue)
PLPHYSICS_API bool PLPhysics::SNRagdoll::GetUseGravity ( ) const
PLPHYSICS_API void PLPhysics::SNRagdoll::SetUseGravity ( bool  bValue)

Returns the PL physics world scene node container the ragdoll is in.

Returns:
The PL physics world scene node container the ragdoll is in, a null pointer on error (if that's the case, something went totally wrong :)
Note:
  • This PL physics world scene node container can be another as the scene node container this scene node is in
PLPHYSICS_API void PLPhysics::SNRagdoll::ClearRagdoll ( )

Clears the radgoll.

PLPHYSICS_API bool PLPhysics::SNRagdoll::CreateRagdoll ( PLMesh::SkeletonHandler pSkeletonHandler = nullptr)

Creates the ragdoll using a skeleton handler.

Parameters:
[in]pSkeletonHandlerSkeleton handler to get the ragdoll information from, if a null pointer, a ragdoll is created automatically using the skeleton handler of the used mesh
Returns:
'true' if all went fine, else 'false'
Remarks:
This function will create a ragdoll from a skeleton handler for you automatically. After the ragdoll was created, you just have to tweak it if required.
Note:
  • Only the main layout can be created using the skeleton handler (bodies, joints, positions, rotations etc.)
  • Default joint type: Universal
  • Default body size: 0.2 'length' 0.2
  • Default body mass: 1.0
  • The joint limits are between -0.5 and 0.5
PLPHYSICS_API void PLPhysics::SNRagdoll::CreatePhysics ( bool  bAllowAttachToWorld = true)

Creates the physics.

Parameters:
[in]bAllowAttachToWorldIs it allowed to attach joints to the world?
Note:

Creates the physics bodies.

Note:
  • After this function all physics bodies are in their initial pose
See also:
PLPHYSICS_API void PLPhysics::SNRagdoll::CreatePhysicsJoints ( bool  bAllowAttachToWorld = true)

Creates the physics joints.

Parameters:
[in]bAllowAttachToWorldIs it allowed to attach joints to the world?
Note:
  • After this function all physics joints are in their initial pose
See also:
PLPHYSICS_API void PLPhysics::SNRagdoll::CreatePhysicsRagdoll ( bool  bAllowAttachToWorld = true)

Creates the physics ragdoll.

Parameters:
[in]bAllowAttachToWorldIs it allowed to attach joints to the world?

Returns the ragdoll skeleton.

Returns:
The ragdoll skeleton, a null pointer on error
PLPHYSICS_API bool PLPhysics::SNRagdoll::IsEnabled ( ) const

Returns whether the ragdoll is enabled or not.

Returns:
'true' if the ragdoll is enabled, else 'false'
PLPHYSICS_API void PLPhysics::SNRagdoll::SetEnabled ( bool  bEnabled = true)

Enables/disables all bodies and joints.

Parameters:
[in]bEnabled'true' if the ragdoll is enabled, else 'false'
PLPHYSICS_API PLCore::uint32 PLPhysics::SNRagdoll::GetNumOfBodies ( ) const

Returns the number of bodies.

Returns:
The number of bodies
PLPHYSICS_API RagdollBody* PLPhysics::SNRagdoll::GetBody ( PLCore::uint32  nIndex) const

Returns a body.

Parameters:
[in]nIndexIndex of the requested body
Returns:
The requested body, a null pointer on error
PLPHYSICS_API RagdollBody* PLPhysics::SNRagdoll::GetBody ( const PLCore::String sName) const

Returns a body.

Parameters:
[in]sNameName of the requested body
Returns:
The requested body, a null pointer on error
PLPHYSICS_API RagdollBody* PLPhysics::SNRagdoll::AddBody ( const PLCore::String sName = "Joint",
bool  bCreatePhysics = true 
)

Adds a new body.

Parameters:
[in]sNameDesired name
[in]bCreatePhysicsCreate the physics body after the body was added?
Returns:
The new ragdoll body, a null pointer on error
PLPHYSICS_API RagdollBody* PLPhysics::SNRagdoll::CloneBody ( PLCore::uint32  nIndex,
bool  bCreatePhysics = true 
)

Clones a body.

Parameters:
[in]nIndexIndex of the body to clone
[in]bCreatePhysicsCreate the physics body after the cloned body was added?
Returns:
The new cloned ragdoll body, a null pointer on error
PLPHYSICS_API bool PLPhysics::SNRagdoll::RemoveBody ( PLCore::uint32  nIndex)

Removes a body.

Parameters:
[in]nIndexIndex of the body to remove
Returns:
'true' if all went fine, else 'false'
PLPHYSICS_API bool PLPhysics::SNRagdoll::RemoveBodyAndJoint ( PLCore::uint32  nIndex)

Removes a body and the joint attached to it.

Parameters:
[in]nIndexIndex of the body to remove
Returns:
'true' if all went fine, else 'false'
PLPHYSICS_API PLCore::uint32 PLPhysics::SNRagdoll::GetNumOfJoints ( ) const

Returns the number of joints.

Returns:
The number of joints
PLPHYSICS_API RagdollJoint* PLPhysics::SNRagdoll::GetJoint ( PLCore::uint32  nIndex) const

Returns a joint.

Parameters:
[in]nIndexIndex of the requested joint
Returns:
The requested joint, a null pointer on error
PLPHYSICS_API RagdollJoint* PLPhysics::SNRagdoll::GetJoint ( const PLCore::String sName) const

Returns a joint.

Parameters:
[in]sNameName of the requested joint
Returns:
The requested joint, a null pointer on error
PLPHYSICS_API RagdollJoint* PLPhysics::SNRagdoll::AddJoint ( const PLCore::String sName = "Joint",
bool  bCreatePhysics = true 
)

Adds a new joint.

Parameters:
[in]sNameDesired name
[in]bCreatePhysicsCreate the physics joint after the joint was added?
Returns:
The new ragdoll joint, a null pointer on error
PLPHYSICS_API RagdollJoint* PLPhysics::SNRagdoll::CloneJoint ( PLCore::uint32  nIndex,
bool  bCreatePhysics = true 
)

Clones a joint.

Parameters:
[in]nIndexIndex of the joint to clone
[in]bCreatePhysicsCreate the physics joint after the cloned joint was added?
Returns:
The new cloned ragdoll joint, a null pointer on error
PLPHYSICS_API bool PLPhysics::SNRagdoll::RemoveJoint ( PLCore::uint32  nIndex)

Removes a joint.

Parameters:
[in]nIndexIndex of the joint to remove
Returns:
'true' if all went fine, else 'false'
PLPHYSICS_API PLCore::uint32 PLPhysics::SNRagdoll::GetNumOfNoCollisions ( ) const

Returns the number of no collisions.

Returns:
The number of no collisions

Adds a new no collision.

Returns:
The new no collision, a null pointer on error
PLPHYSICS_API NoCollision* PLPhysics::SNRagdoll::GetNoCollision ( PLCore::uint32  nIndex) const

Returns a no collision.

Parameters:
[in]nIndexIndex of the requested no collision
Returns:
The requested no collision, a null pointer on error
PLPHYSICS_API bool PLPhysics::SNRagdoll::RemoveNoCollision ( PLCore::uint32  nIndex)

Removes a no collision.

Parameters:
[in]nIndexIndex of the no collision to remove
Returns:
'true' if all went fine, else 'false'
PLPHYSICS_API PLCore::uint32 PLPhysics::SNRagdoll::GetNumOfControllers ( ) const

Returns the number of controllers.

Returns:
The number of controllers
PLPHYSICS_API JointController* PLPhysics::SNRagdoll::AddController ( const PLCore::String sJointName)

Adds a new controller.

Parameters:
[in]sJointNameName of the joint to control
Returns:
The new (if not already created) controller, a null pointer on error
PLPHYSICS_API JointController* PLPhysics::SNRagdoll::GetController ( PLCore::uint32  nIndex) const

Returns a controller.

Parameters:
[in]nIndexIndex of the requested controller
Returns:
The requested controller, a null pointer on error
PLPHYSICS_API JointController* PLPhysics::SNRagdoll::GetController ( const PLCore::String sName) const

Returns a controller.

Parameters:
[in]sNameName of the requested controller
Returns:
The requested controller, a null pointer on error
PLPHYSICS_API bool PLPhysics::SNRagdoll::RemoveController ( PLCore::uint32  nIndex)

Removes a controller.

Parameters:
[in]nIndexIndex of the controller to remove
Returns:
'true' if all went fine, else 'false'
virtual PLPHYSICS_API void PLPhysics::SNRagdoll::DrawDebug ( PLRenderer::Renderer cRenderer,
const PLScene::VisNode pVisNode = nullptr 
) [override, virtual]

This function is called when the debug parts of the scene are drawn.

Parameters:
[in]cRendererThe used renderer
[in]pVisNodeThe current visibility node of this scene node, can be a null pointer
Note:
  • Should only be called if the 'UseDrawDebug' draw flag and the 'DebugEnabled' debug flag is set
  • Beside drawing scene node stuff, the default implementation emits the SignalDrawDebug signal
See also:

Reimplemented from PLScene::SNMesh.

virtual PLPHYSICS_API void PLPhysics::SNRagdoll::InitFunction ( ) [override, protected, virtual]

This function is called when the scene node gets initialized.

Reimplemented from PLScene::SceneNode.

virtual PLPHYSICS_API void PLPhysics::SNRagdoll::DeInitFunction ( ) [override, protected, virtual]

This function is called when the scene node gets de-initialized.

Reimplemented from PLScene::SNMesh.

virtual PLPHYSICS_API void PLPhysics::SNRagdoll::OnActivate ( bool  bActivate) [override, protected, virtual]

Called when the scene node has been activated or deactivated.

Parameters:
[in]bActivate'true' if the scene node is now active, else 'false'
Note:
  • The scene node "Inactive"-flag as well as the "Frozen"-flag are taken into account
  • 'bActivate' will be 'true' if the scene node AND the parent scene container (recursive!) are active
  • 'bActivate' will be 'false' if the scene node OR the parent scene container (recursive!) is inactive
  • The default implementation calls the "OnActivate()" of all attached scene node modifiers

Reimplemented from PLScene::SceneNode.

virtual PLPHYSICS_API bool PLPhysics::SNRagdoll::Unload ( ) [override, virtual]

Unloads the loadable.

Returns:
'true' if all went fine, else 'false'

Reimplemented from PLCore::Loadable.

virtual PLPHYSICS_API PLCore::String PLPhysics::SNRagdoll::GetLoadableTypeName ( ) const [override, virtual]

Returns the loadable type name.

Returns:
The loadable type name

Reimplemented from PLCore::Loadable.

virtual PLPHYSICS_API bool PLPhysics::SNRagdoll::CallLoadable ( PLCore::File cFile,
PLCore::Loader cLoader,
const PLCore::String sMethod,
const PLCore::String sParams 
) [override, protected, virtual]

Calls the loadable in order to load or save.

Parameters:
[in]cFileFile to load from, MUST be opened
[in]cLoaderLoader to use
[in]sMethodName of the method to use
[in]sParamsMethod parameters
Returns:
'true' if all went fine, else 'false'
Note:
  • The default implementation is empty and will return always 'false'

Reimplemented from PLCore::Loadable.


The documentation for this class was generated from the following file:


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:37
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported