Skip to content

[rmodels] Animation issue with the GLB/GLTF files #4569

Closed
@efeozyer

Description

@efeozyer
  • [ x ] I tested it on latest raylib version from master branch
  • [ x ] I checked there is no similar issue already reported
  • [ x ] I checked the documentation on the wiki
  • [ x ] My code has no errors or misuse of raylib

Issue description

Hi folks, I recently started using Raylib with the basic setup. Basically I was trying to load ,GLB file and animate it.
You can see there, my character how looks like without animation.

image

But.. that happens when I called UpdateModelAnimation method.
image

I thought that, something wrong with my .GLB file but I have tried this, web site and it was working properly.

https://gltf-viewer.donmccurdy.com/

Environment

Windows x64 \ Raylib 5.5 \ VC++

Additional files

orc_warrior.zip

// Raylib.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "raylib.h"
#include <iostream>

int main()
{
	InitWindow(800, 600, "Raylib Window");

	int animCount = 0;
	int animFrame = 0;
	auto model = LoadModel("orc_warrior.glb");
	auto animations = LoadModelAnimations("orc_warrior.glb", &animCount);

	Camera camera = { 0 };
	camera.position = { 4.0f, 4.0f, 4.f };
	camera.target = { 0.0f, 2.0f, 0.0f };
	camera.up = { 0.0f, 1.0f, 0.0f };
	camera.fovy = 60.0f;
	camera.projection = CAMERA_PERSPECTIVE;

	while (!WindowShouldClose()) {
		BeginDrawing();
		ClearBackground(BLACK);
		BeginMode3D(camera);
		DrawText("Hello, Raylib!", 190, 200, 20, LIGHTGRAY);
		DrawModel(model, { 0.0f, 0.0f, 0.0f }, 1.0f, WHITE);
		
		if (IsKeyDown(KEY_W))
		{
			UpdateModelAnimation(model, animations[0], animFrame);
			if (animFrame >= animations[0].frameCount) {
				animFrame = 0;
			}
			animFrame++;
		}

		DrawGrid(100, 5);
		EndMode3D();
		EndDrawing();
	}
	CloseWindow();
	return 0;
}


Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions