![]() |
ezEngine Release 26.3
|
#include <AnimController.h>
Classes | |
| struct | AnimClipInfo |
Public Member Functions | |
| void | Initialize (const ezSkeletonResourceHandle &hSkeleton, ezAnimPoseGenerator &ref_poseGenerator, const ezSharedPtr< ezBlackboard > &pBlackboard=nullptr) |
| bool | Update (ezTime diff, ezGameObject *pTarget, bool bEnableIK) |
| void | GetRootMotion (ezVec3 &ref_vTranslation, ezAngle &ref_rotationX, ezAngle &ref_rotationY, ezAngle &ref_rotationZ) const |
| const ezSharedPtr< ezBlackboard > & | GetBlackboard () |
| ezAnimPoseGenerator & | GetPoseGenerator () |
| void | SetOutputModelTransform (ezAnimGraphPinDataModelTransforms *pModelTransform) |
| void | SetRootMotion (const ezVec3 &vTranslation, ezAngle rotationX, ezAngle rotationY, ezAngle rotationZ) |
| void | AddOutputLocalTransforms (ezAnimGraphPinDataLocalTransforms *pLocalTransforms) |
| ezAnimGraphPinDataBoneWeights * | AddPinDataBoneWeights () |
| ezAnimGraphPinDataLocalTransforms * | AddPinDataLocalTransforms () |
| ezAnimGraphPinDataModelTransforms * | AddPinDataModelTransforms () |
| void | AddAnimGraph (const ezAnimGraphResourceHandle &hGraph) |
| const AnimClipInfo & | GetAnimationClipInfo (ezTempHashedString sClipName) const |
| void | SetAnimationClipInfo (const ezHashedString &sClipName, const AnimClipInfo &info) |
Static Public Member Functions | |
| static ezSharedPtr< ezAnimGraphSharedBoneWeights > | CreateBoneWeights (const char *szUniqueName, const ezSkeletonResource &skeleton, ezDelegate< void(ezAnimGraphSharedBoneWeights &)> fill) |
Manages and updates animation graph instances to generate animation poses.
This is the runtime bridge between animation graphs (ezAnimGraph) and the pose generation system (ezAnimPoseGenerator). It owns graph instances, manages their execution, handles data flow between graph nodes, and forwards the final pose to the renderer.
Typically owned by ezAnimationControllerComponent. The component calls Initialize() once, then Update() every frame to generate new animation poses.
Basic workflow:
The blackboard is used for communication between gameplay code and animation graphs. Nodes can read blackboard values (movement speed, aim direction) to drive blending, and write values (footstep events, animation state) back to gameplay.
Multiple animation graphs can be added to create layered animations (e.g., base locomotion
| void ezAnimController::AddAnimGraph | ( | const ezAnimGraphResourceHandle & | hGraph | ) |
Loads an animation graph and creates a runtime instance for it.
Multiple graphs can be added to layer animations. They are evaluated in the order added.
|
static |
Creates or retrieves a shared bone weight mask.
Bone weights are shared globally across all characters to save memory. The fill delegate is called only once when the weights are first created. Subsequent calls with the same name return the cached weights.
| void ezAnimController::GetRootMotion | ( | ezVec3 & | ref_vTranslation, |
| ezAngle & | ref_rotationX, | ||
| ezAngle & | ref_rotationY, | ||
| ezAngle & | ref_rotationZ | ||
| ) | const |
Retrieves accumulated root motion from the last Update().
Root motion is the translation and rotation extracted from animations, used to move characters based on their animation. This could be applied to the character controller or entity.
| void ezAnimController::Initialize | ( | const ezSkeletonResourceHandle & | hSkeleton, |
| ezAnimPoseGenerator & | ref_poseGenerator, | ||
| const ezSharedPtr< ezBlackboard > & | pBlackboard = nullptr |
||
| ) |
Initializes the controller with a skeleton and pose generator.
Must be called before adding graphs or updating. The optional blackboard is used for data sharing between animation graphs and gameplay code.
| void ezAnimController::SetAnimationClipInfo | ( | const ezHashedString & | sClipName, |
| const AnimClipInfo & | info | ||
| ) |
Sets which animation clip is used for the named animation.
Should only be called right at the start or when it is absolutely certain that an animation clip isn't in use right now, otherwise the running animation playback may produce weird results.
| bool ezAnimController::Update | ( | ezTime | diff, |
| ezGameObject * | pTarget, | ||
| bool | bEnableIK | ||
| ) |
Updates all animation graph instances and generates the final pose.
Steps all nodes in all graphs, accumulates results, forwards the final pose to the pose generator, and sends ezMsgAnimationPoseUpdated to the target object and its children.
Returns false if the target requested to stop animating via msg.m_bContinueAnimating.