44*
55* LIMITATIONS:
66* - Only supports 1 armature per file, and skips loading it if there are multiple armatures
7- * - Only supports linear interpolation (default method in Blender when checked
7+ * - Only supports linear interpolation (default method in Blender when checked
88* "Always Sample Animations" when exporting a GLTF file)
9- * - Only supports translation/rotation/scale animation channel.path,
9+ * - Only supports translation/rotation/scale animation channel.path,
1010* weights not considered (i.e. morph targets)
1111*
1212* Example originally created with raylib 3.7, last time updated with raylib 4.2
@@ -42,7 +42,7 @@ int main(void)
4242
4343 // Load gltf model
4444 Model model = LoadModel ("resources/models/gltf/robot.glb" );
45-
45+
4646 // Load gltf model animations
4747 unsigned int animsCount = 0 ;
4848 unsigned int animIndex = 0 ;
@@ -63,9 +63,9 @@ int main(void)
6363 //----------------------------------------------------------------------------------
6464 UpdateCamera (& camera , CAMERA_THIRD_PERSON );
6565 // Select current animation
66- if (IsKeyPressed ( KEY_UP )) animIndex = (animIndex + 1 )%animsCount ;
67- else if (IsKeyPressed ( KEY_DOWN )) animIndex = (animIndex + animsCount - 1 )%animsCount ;
68-
66+ if (IsMouseButtonPressed ( MOUSE_BUTTON_RIGHT )) animIndex = (animIndex + 1 )%animsCount ;
67+ else if (IsMouseButtonPressed ( MOUSE_BUTTON_LEFT )) animIndex = (animIndex + animsCount - 1 )%animsCount ;
68+
6969 // Update model animation
7070 ModelAnimation anim = modelAnimations [animIndex ];
7171 animCurrentFrame = (animCurrentFrame + 1 )%anim .frameCount ;
@@ -85,7 +85,7 @@ int main(void)
8585
8686 EndMode3D ();
8787
88- DrawText ("Use the UP/DOWN arrow keys to switch animation" , 10 , 10 , 20 , GRAY );
88+ DrawText ("Use the LEFT/RIGHT mouse buttons to switch animation" , 10 , 10 , 20 , GRAY );
8989 DrawText (TextFormat ("Animation: %s" , anim .name ), 10 , GetScreenHeight () - 20 , 10 , DARKGRAY );
9090
9191 EndDrawing ();
0 commit comments