godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.56k stars 21.27k forks source link

Skeleton / Animation doesn't import correctly from Gltf #86834

Open prominentdetail opened 11 months ago

prominentdetail commented 11 months ago

Tested versions

v4.2.2.rc.custom_build [f54e666c2] and v4.3dev1

System information

windows 10

Issue description

The imported gltf doesn't import animation/skeleton correctly. If you play the animations(there is idle and walk) in windows 3d viewer it loads and plays fine, but in godot it doesn't

windows 3d viewer: walkwin

godot: walkgodot

It appears like the objects that the bones are attached to aren't being animated, but the bones are.

Steps to reproduce

import this gltf: characterVid.zip

Minimal reproduction project (MRP)

characterVid.zip

fire commented 11 months ago

https://github.khronos.org/glTF-Validator/ suggests this is an invalid file

fire commented 11 months ago

Doing a roundtrip by opening in blender and then saving a game creates a valid file.

The errors seem to be incorrectly defining mesh animations.

image

prominentdetail commented 11 months ago

I imported and exported from the three.js editor https://threejs.org/editor/ and it still gives me the same errors in the gltf-validator. So I'm not sure how to change the exported data to be any different. Other programs load the animations just fine, so maybe Godot should improve their importer. I'll try to keep looking into it though.

prominentdetail commented 11 months ago

Here is a gltf file that is valid but still exhibits the same problem: animationtestgodot2.zip

how it should look: spinviewer

how it looks in godot: spingodot

I'll continue investigating..

prominentdetail commented 11 months ago

Ok, I think I managed to fix it. When I place the skinned meshes into another object and animate those objects instead of the skinned mesh, then it imports fine. I'm going to still try and learn more about it, but I think that was the issue (animating skinned meshes).

prominentdetail commented 11 months ago

I'm not sure if I've sorted it out yet. I can't tell if it is a godot issue or my exporter issue yet. Godot seems to be adding extra nodes for the skinnedmesh. Or maybe its my exporter- I'm not sure.

Edit: Seems like I sorted out that. I had to make the root bone in the skeleton a child of the parent object (not the skinnedmesh). Now godot doesn't create extra nodes when I import it.