Struct AnimatedModelInstance
Lightweight per-entity state for an animated model (Flyweight extrinsic state). Playback lives here (~20 bytes); mesh/clips live on the shared AnimatedModelData.
Pose and draw are adjacent: Update(float) only advances the frame, Draw(Vector3, Vector3, Vector3, Color)
uploads bone matrices then draws. Never call Raylib.UpdateModelAnimation on a GPU-skinned
model — that writes posed vertices into the VBO, and the shader then skins them again
(collapsed/exploded mesh).
Inherited Members
Namespace: PopcorningGuineaPig.Engine.Gameplay
Assembly: PopcorningGuineaPig.Engine.dll
Syntax
public struct AnimatedModelInstance
Constructors
| Edit this page View SourceAnimatedModelInstance(AnimatedModelData)
Declaration
public AnimatedModelInstance(AnimatedModelData data)
Parameters
| Type | Name | Description |
|---|---|---|
| AnimatedModelData | data |
Properties
| Edit this page View SourceAnimationSpeed
Playback speed multiplier (1.0 = normal speed).
Declaration
public float AnimationSpeed { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| float |
CurrentAnimIndex
Index of the currently active animation.
Declaration
public int CurrentAnimIndex { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| int |
CurrentFrame
Current frame in the active animation.
Declaration
public int CurrentFrame { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Data
Reference to the shared model and animation data.
Declaration
public readonly AnimatedModelData Data { get; }
Property Value
| Type | Description |
|---|---|
| AnimatedModelData |
IsLooping
Whether the animation loops or plays once.
Declaration
public bool IsLooping { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
IsPlaying
Whether the animation is currently playing.
Declaration
public bool IsPlaying { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
IsValid
True if the underlying shared data is valid and not disposed.
Declaration
public readonly bool IsValid { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
| Edit this page View SourceApplyPose()
Pushes this instance's current frame onto the shared model.
Declaration
public void ApplyPose()
Remarks
Call immediately before drawing when several instances share one AnimatedModelData. The palette for a frame is built once and copied onto the model, so the last copy is the one that draws. The CPU fallback re-skins every vertex.
Draw(Vector3, Vector3, Vector3, Color)
Renders the model with the current animation pose.
Declaration
public void Draw(Vector3 position, Vector3 rotationDeg, Vector3 scale, Color tint)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | position | The position to render at. |
| Vector3 | rotationDeg | The rotation in degrees around each axis. |
| Vector3 | scale | The scale to apply. |
| Color | tint | The color tint to apply. |
PlayAnimation(int)
Starts playing the animation at the specified index.
Declaration
public void PlayAnimation(int animIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | animIndex | The index of the animation to play. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Thrown if animIndex is invalid. |
PlayAnimation(string)
Starts playing the animation with the specified name.
Declaration
public void PlayAnimation(string animName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | animName | The name of the animation to play. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the animation name is not found. |
StopAnimation()
Stops the current animation playback.
Declaration
public void StopAnimation()
Update(float)
Updates the animation playback based on elapsed time.
Declaration
public void Update(float deltaTime)
Parameters
| Type | Name | Description |
|---|---|---|
| float | deltaTime | Time elapsed since the last update. |