Skip to content

raylib.UpdateModelAnimation

JoeStrout edited this page Apr 29, 2026 · 2 revisions

Update model animation data (vertex buffers / bone matrices) for a specific pose NOTE 1: Request frame could be fractional, using a lerp interpolation between two frames NOTE 2: Updated vertex animation data is uploaded to GPU in case of CPU skinning, for GPU skinning, bone matrices are uploaded to shader on DrawModelEx()

Parameters

Parameter Default Value Note
model
animation
frame 0

Return value

None.

Notes

Example

camera = {position:[0,5,10], target:[0,0,0], up:[0,1,0], fovy:45, projection:raylib.CAMERA_PERSPECTIVE}
raylib.InitWindow 800, 600, "UpdateModelAnimation"
model = raylib.LoadModel("character.glb")
anims = raylib.LoadModelAnimations("character.glb")
frameCounter = 0
while not raylib.WindowShouldClose
    frameCounter = frameCounter + 1
    if frameCounter >= anims[0].frameCount then frameCounter = 0
    raylib.UpdateModelAnimation model, anims[0], frameCounter
    raylib.BeginDrawing
    raylib.ClearBackground raylib.RAYWHITE
    raylib.BeginMode3D camera
    raylib.DrawGrid 10, 1.0
    raylib.DrawModel model, [0,0,0], 1.0, raylib.WHITE
    raylib.EndMode3D
    raylib.EndDrawing
end while
raylib.UnloadModelAnimations anims
raylib.UnloadModel model
raylib.CloseWindow

Clone this wiki locally