Class CAnimatedAssimpModel
Defined in File CAnimatedAssimpModel.h
Nested Relationships
Nested Types
Inheritance Relationships
Base Type
public mrpt::viz::CAssimpModel(Class CAssimpModel)
Class Documentation
-
class CAnimatedAssimpModel : public mrpt::viz::CAssimpModel
Extension of CAssimpModel with skeletal animation support.
Supports models that contain bone hierarchies and keyframed animations (FBX, glTF/GLB, Collada, etc. via Assimp).
CPU-side vertex skinning is performed each time the animation time changes: bind-pose vertex positions are stored on first load and then transformed through the active bone matrices every frame.
Usage:
auto model = CAnimatedAssimpModel::Create(); model->loadScene("character.glb"); // In simulation loop: model->setAnimationTime(simTime); // updates bone transforms & rebuilds geometry
Public Functions
-
CAnimatedAssimpModel() = default
-
void loadScene(const std::string &file_name, int flags = LoadFlags::RealTimeMaxQuality | LoadFlags::FlipUVs | LoadFlags::Verbose)
Loads a 3D scene and extracts skeleton/animation data.
-
void setAnimationTime(double timeSeconds)
Set current animation time in seconds. Updates all bone transforms for the active animation and rebuilds the mesh geometry with skinned positions.
-
double getAnimationDuration(size_t animIndex = 0) const
Get animation duration in seconds.
-
size_t getAnimationCount() const
Get number of animations in the model.
-
std::string getAnimationName(size_t animIndex) const
Get animation name by index.
-
void setActiveAnimation(size_t animIndex)
Select which animation to play (by index).
-
void setActiveAnimation(const std::string &animName)
Select which animation to play (by name). Does nothing if the name is not found.
-
inline void setLooping(bool loop)
Enable/disable animation looping.
-
double getAnimationProgress() const
Get current normalized animation progress [0,1].
-
inline size_t getBoneCount() const
Get number of bones.
-
int getBoneIndex(const std::string &boneName) const
Get bone index by name, or -1 if not found.
-
void setBoneLocalTransform(size_t boneIndex, const mrpt::math::CMatrixDouble44 &localTransform)
Override a bone’s local transform (for procedural animation).
-
void clearBoneOverrides()
Clear all bone overrides, return to animation-driven transforms.
-
CAnimatedAssimpModel() = default