Repository navigation
raylib.UpdateModelAnimation
JoeStrout edited this page Nov 16, 2026
·
3 revisions
Update model animation data (vertex buffers / bone matrices) to the pose at a given frame. frame may be fractional, interpolating between two frames. With CPU skinning the vertex data is uploaded to the GPU now; with GPU skinning, bone matrices go to the shader when the model is drawn
| Parameter | Default Value | Note |
|---|---|---|
| model | ||
| animation | ||
| frame | 0 |
None.
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