Skip to content

[Sample] Don't succeed to use ModelAnimation #27

@BorisFR

Description

@BorisFR

I'm loding a gltf mesh with animations but can't use animation.

int currentFrame = 0;
ModelAnimation[] theAnim;
...
ReadOnlySpan<ModelAnimation> anims = ModelAnimation.LoadAnimations("resources/models/player/Robo.gltf");
theAnim = anims.ToArray();
Console.WriteLine($"*** Animation : {theAnim[0].Name}");
...
currentFrame = (currentFrame+1) % theAnim[0].FrameCount;
theAnim[0].Update(model, currentFrame);

and the result :

INFO: FILEIO: [resources/models/player/Robo.gltf] File loaded successfully
INFO: FILEIO: [resources/models/player/Robo.bin] File loaded successfully
INFO: MODEL: [resources/models/player/Robo.gltf] Loaded animation: Robo|Robo_Idle (469 frames, 7.966667s)
INFO: MODEL: [resources/models/player/Robo.gltf] Loaded animation: Robo|Robo_accelerate (57 frames, 0.966667s)
INFO: MODEL: [resources/models/player/Robo.gltf] Loaded animation: Robo|Robo_forward (116 frames, 1.966667s)
INFO: MODEL: [resources/models/player/Robo.gltf] Loaded animation: Robo|Robo_decelerate (57 frames, 0.966667s)
*** Animation : Robo|Robo_Idle
Fatal error. 0xC0000005
at Raylib_CSharp.Apis.RaylibApi.UpdateModelAnimation(Raylib_CSharp.Geometry.Model, Raylib_CSharp.Geometry.ModelAnimation, Int32)
at Raylib_CSharp.Geometry.ModelAnimation.Update(Raylib_CSharp.Geometry.Model, Int32)
at BattleAIviewer.Helper.Player.Draw()
at BattleAIviewer.Program.Main(System.String[])

I don't find what i'm doing wrong. Could someone please help me?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions