Open 3D Engine EMotionFX Gem API Reference  24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
EMotionFX::MotionLayerSystem Class Reference

#include <MotionLayerSystem.h>

Inherits EMotionFX::MotionSystem.

Public Types

enum  { TYPE_ID = 0x00000001 }
 

Public Member Functions

void Update (float timePassed, bool updateNodes) override
 
MotionInstanceFindFirstNonMixingMotionInstance () const override
 
size_t RemoveLayersBelow (MotionInstance *source)
 
void UpdateMotionTree ()
 
uint32 GetType () const override
 
const char * GetTypeString () const override
 
size_t FindInsertPos (size_t priorityLevel) const
 
void RemoveAllLayerPasses (bool delFromMem=true)
 
void AddLayerPass (LayerPass *newPass)
 
size_t GetNumLayerPasses () const
 
void RemoveLayerPass (size_t nr, bool delFromMem=true)
 
void RemoveLayerPass (LayerPass *pass, bool delFromMem=true)
 
void InsertLayerPass (size_t insertPos, LayerPass *pass)
 
void RemoveRepositioningLayerPass ()
 
LayerPassGetLayerPass (size_t index) const
 
- Public Member Functions inherited from EMotionFX::MotionSystem
virtual MotionInstancePlayMotion (Motion *motion, class PlayBackInfo *info=nullptr)
 
void RemoveMotion (size_t nr, bool deleteMem=true)
 
void RemoveMotion (MotionInstance *motion, bool delMem=true)
 
virtual bool RemoveMotionInstance (MotionInstance *instance)
 
MotionInstanceGetMotionInstance (size_t nr) const
 
size_t GetNumMotionInstances () const
 
bool CheckIfIsValidMotionInstance (MotionInstance *instance) const
 
bool GetIsPlaying () const
 
bool CheckIfIsPlayingMotion (Motion *motion, bool ignorePausedMotions=false) const
 
void SetMotionQueue (MotionQueue *motionQueue)
 
void AddMotionQueue (MotionQueue *motionQueue)
 
MotionQueueGetMotionQueue () const
 
ActorInstanceGetActorInstance () const
 
void StopAllMotions ()
 
void StopAllMotions (Motion *motion)
 
void AddMotionInstance (MotionInstance *instance)
 
- Public Member Functions inherited from MCore::RefCounted
 RefCounted ()
 
virtual ~RefCounted ()
 
void IncreaseReferenceCount ()
 
void DecreaseReferenceCount ()
 
void Destroy ()
 
uint32 GetReferenceCount () const
 

Static Public Member Functions

static MotionLayerSystemCreate (ActorInstance *actorInstance)
 

Additional Inherited Members

- Protected Member Functions inherited from EMotionFX::MotionSystem
 MotionSystem (ActorInstance *actorInstance)
 
virtual ~MotionSystem ()
 
void UpdateMotionInstances (float timePassed)
 
MotionInstanceCreateMotionInstance (Motion *motion, PlayBackInfo *info)
 
- Protected Member Functions inherited from MCore::RefCounted
virtual void Delete ()
 
- Protected Attributes inherited from EMotionFX::MotionSystem
AZStd::vector< MotionInstance * > m_motionInstances
 
ActorInstancem_actorInstance
 
MotionQueuem_motionQueue
 

Detailed Description

The layered motion system class. This class performs the blending, mixing and motion management for us. The system contains a set of layers, which are linked together in a hierarchy. The current implementation however manages the system on such a way that we get a stack of layers. The following diagram gives an example of the layout of layers inside this system:


  FINAL OUTPUT
       ^
       |
       |
  75%  |  25%
---------------
| lay2 | run  |  layer 1 (root layer)
---------------
  \
   \
    \
 30% \   70%
--------------
| jump | walk |  layer 2
---------------
  \
   \
    \
     \   100%
--------------
|      | jump |  layer 3
---------------

As you can see a layer consists of 2 inputs and a weight factor between these two inputs. An input can either be a motion or the output of another layer. When a motion is being played we don't have to bother about the adding and removing of layers and things such as smooth transitions etc. This is all performed by this system.

Member Function Documentation

◆ AddLayerPass()

void EMotionFX::MotionLayerSystem::AddLayerPass ( LayerPass newPass)

Add a layer pass. This layer will be added on the back, so processed as last.

Parameters
newPassThe new pass to add.

◆ Create()

static MotionLayerSystem* EMotionFX::MotionLayerSystem::Create ( ActorInstance actorInstance)
static

Creation method.

Parameters
actorInstanceThe actor instance where this layer belongs to.

◆ FindFirstNonMixingMotionInstance()

MotionInstance* EMotionFX::MotionLayerSystem::FindFirstNonMixingMotionInstance ( ) const
overridevirtual

Recursively search for the first non mixing motion and return the motion instance.

Returns
A pointer to the motion instance.

Implements EMotionFX::MotionSystem.

◆ FindInsertPos()

size_t EMotionFX::MotionLayerSystem::FindInsertPos ( size_t  priorityLevel) const

Find the location where to insert a motion layer with a given priority level. When InvalidIndex is returned, it needs to be inserted at the bottom of the motion tree.

Parameters
priorityLevelThe priority level of the motion instance you want to insert.
Returns
The insert pos in the list of motion instances, or InvalidIndex when the new layer has to be inserted at the bottom of the tree.

◆ GetLayerPass()

LayerPass* EMotionFX::MotionLayerSystem::GetLayerPass ( size_t  index) const

Get the pointer to a given layer pass.

Parameters
indexThe layer pass number, which must be in range of [0..GetNumLayerPasses()-1].
Returns
A pointer to the layer pass object.

◆ GetNumLayerPasses()

size_t EMotionFX::MotionLayerSystem::GetNumLayerPasses ( ) const

Get the number of layer passes currently added to this motion layer system.

Returns
The number of layer passes.

◆ GetType()

uint32 EMotionFX::MotionLayerSystem::GetType ( ) const
overridevirtual

Get the unique motion system type ID.

Returns
The motion system type identification number.

Implements EMotionFX::MotionSystem.

◆ GetTypeString()

const char* EMotionFX::MotionLayerSystem::GetTypeString ( ) const
overridevirtual

Get the type identification string. This can be a description or the class name of the motion system.

Returns
A pointer to the string containing the name.

Implements EMotionFX::MotionSystem.

◆ InsertLayerPass()

void EMotionFX::MotionLayerSystem::InsertLayerPass ( size_t  insertPos,
LayerPass pass 
)

Insert a layer pass in the array of layer passes.

Parameters
insertPosThe index position to insert the layer pass.
passThe layer pass to insert.

◆ RemoveAllLayerPasses()

void EMotionFX::MotionLayerSystem::RemoveAllLayerPasses ( bool  delFromMem = true)

Remove all layer passes.

Parameters
delFromMemWhen set to true, the layer passes will also be deleted from memory.

◆ RemoveLayerPass() [1/2]

void EMotionFX::MotionLayerSystem::RemoveLayerPass ( LayerPass pass,
bool  delFromMem = true 
)

Remove a given layer pass by pointer.

Parameters
passA pointer to the layer pass to remove.
delFromMemWhen set to true, the layer passes will also be deleted from memory.

◆ RemoveLayerPass() [2/2]

void EMotionFX::MotionLayerSystem::RemoveLayerPass ( size_t  nr,
bool  delFromMem = true 
)

Remove a given layer pass by index.

Parameters
nrThe layer pass number to remove.
delFromMemWhen set to true, the layer passes will also be deleted from memory.

◆ RemoveLayersBelow()

size_t EMotionFX::MotionLayerSystem::RemoveLayersBelow ( MotionInstance source)

Remove all motion layers below the current one.

Parameters
sourceThe layer to remove all layers below from. So this does not remove the source layer itself.
Returns
Returns the number of removed layers.

◆ RemoveRepositioningLayerPass()

void EMotionFX::MotionLayerSystem::RemoveRepositioningLayerPass ( )

Deletes the motion based actor repositioning layer pass, which is always there on default. Please keep in mind that this one is actually stored outside of the array with layer passes that you can add new layers to. If you want to use your own repositioning code, you can disable the built-in one with this method, and add your own repositioning layer.

◆ Update()

void EMotionFX::MotionLayerSystem::Update ( float  timePassed,
bool  updateNodes 
)
overridevirtual

Update this character motions, if updateNodes is false only time values are updated. If it's true, the heavy calcs are done. NOTE: This method is automatically called by the Update method.

Parameters
timePassedThe time passed since the last call.
updateNodesIf true the nodes will be updated.

Implements EMotionFX::MotionSystem.

◆ UpdateMotionTree()

void EMotionFX::MotionLayerSystem::UpdateMotionTree ( )

Update the motion tree. This removes all motion instances that faded out or get overwritten etc.


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