vpenades / SharpGLTF

glTF reader and writer for .NET Standard
MIT License
470 stars 75 forks source link

FindAnimationChannels(Node) always returns the channels of one specific animation #6

Closed KWEngine closed 5 years ago

KWEngine commented 5 years ago

When importing this file... https://www.dropbox.com/s/cby5htymjfm8kop/trump_3anims.gltf?dl=0 ... and iterating through its animations, each animation object seems to link to the channels of the first animation instead to the channels of the actual animation of the iteration cycle:

This is a debug log of the Quaternion of a leg (left upper leg bone) rotation. Animation #: Timestamp in seconds => Quaternion(XYZW)

`0: 0 => -1|-0,09|0|0,02 0: 0,1 => -1|-0,09|0|0,02 0: 0,1 => -1|-0,09|0|0,02 0: 0,1 => -1|-0,09|0|0,02 0: 0,2 => -1|-0,09|0|0,02 0: 0,2 => -1|-0,09|0|0,02 0: 0,2 => -1|-0,09|0|0,02 0: 0,3 => -1|-0,09|0|0,02 0: 0,3 => -1|-0,09|0|0,02 0: 0,3 => -1|-0,09|0|0,02 0: 0,4 => -1|-0,09|0|0,02 0: 0,4 => -1|-0,09|0|0,02 0: 0,4 => -1|-0,09|0|0,02 0: 0,5 => -1|-0,09|0|0,02 0: 0,5 => -1|-0,09|0|0,02 0: 0,5 => -1|-0,09|0|0,02 0: 0,6 => -1|-0,09|0|0,02 0: 0,6 => -1|-0,09|0|0,02 0: 0,6 => -1|-0,09|0|0,02 0: 0,7 => -1|-0,09|0|0,02 0: 0,7 => -1|-0,09|0|0,02 0: 0,7 => -1|-0,09|0|0,02 0: 0,8 => -1|-0,09|0|0,02 0: 0,8 => -1|-0,09|0|0,02 0: 0,8 => -1|-0,09|0|0,02 0: 0,9 => -1|-0,09|0|0,02 0: 0,9 => -1|-0,09|0|0,02 0: 0,9 => -1|-0,09|0|0,02

1: 0 => -1|-0,09|0|0,02 1: 0,1 => -1|-0,09|0|0,02 1: 0,1 => -1|-0,09|0|0,02 1: 0,1 => -1|-0,09|0|0,02 1: 0,2 => -1|-0,09|0|0,02 1: 0,2 => -1|-0,09|0|0,02 1: 0,2 => -1|-0,09|0|0,02 1: 0,3 => -1|-0,09|0|0,02 1: 0,3 => -1|-0,09|0|0,02 1: 0,3 => -1|-0,09|0|0,02 1: 0,4 => -1|-0,09|0|0,02 1: 0,4 => -1|-0,09|0|0,02 1: 0,4 => -1|-0,09|0|0,02 1: 0,5 => -1|-0,09|0|0,02 1: 0,5 => -1|-0,09|0|0,02 1: 0,5 => -1|-0,09|0|0,02 1: 0,6 => -1|-0,09|0|0,02 1: 0,6 => -1|-0,09|0|0,02 1: 0,6 => -1|-0,09|0|0,02 1: 0,7 => -1|-0,09|0|0,02 1: 0,7 => -1|-0,09|0|0,02 1: 0,7 => -1|-0,09|0|0,02 1: 0,8 => -1|-0,09|0|0,02 1: 0,8 => -1|-0,09|0|0,02 1: 0,8 => -1|-0,09|0|0,02 1: 0,9 => -1|-0,09|0|0,02 1: 0,9 => -1|-0,09|0|0,02 1: 0,9 => -1|-0,09|0|0,02

2: 0 => -1|-0,09|0|0,02 2: 0,1 => -1|-0,09|0|0,02 2: 0,1 => -1|-0,09|0|0,02 2: 0,1 => -1|-0,09|0|0,02 2: 0,2 => -1|-0,09|0|0,02 2: 0,2 => -1|-0,09|0|0,02 2: 0,2 => -1|-0,09|0|0,02 2: 0,3 => -1|-0,09|0|0,02 2: 0,3 => -1|-0,09|0|0,02 2: 0,3 => -1|-0,09|0|0,02 2: 0,4 => -1|-0,09|0|0,02 2: 0,4 => -1|-0,09|0|0,02 2: 0,4 => -1|-0,09|0|0,02 2: 0,5 => -1|-0,09|0|0,02 2: 0,5 => -1|-0,09|0|0,02 2: 0,5 => -1|-0,09|0|0,02 2: 0,6 => -1|-0,09|0|0,02 2: 0,6 => -1|-0,09|0|0,02 2: 0,6 => -1|-0,09|0|0,02 2: 0,7 => -1|-0,09|0|0,02 2: 0,7 => -1|-0,09|0|0,02 2: 0,7 => -1|-0,09|0|0,02 2: 0,8 => -1|-0,09|0|0,02 2: 0,8 => -1|-0,09|0|0,02 2: 0,8 => -1|-0,09|0|0,02 2: 0,9 => -1|-0,09|0|0,02 2: 0,9 => -1|-0,09|0|0,02`

The rotations are the same for each animation. It always rotates according to the "idle" animation. The animations #1 and #2 should be different, especially because #2 is a walking animation which definitely rotates the leg differently.

My guess: FindRotationChannels(Node) needs an update concerning the LINQ-selector, or the channels are not imported correctly in the first place.

Greetings, Karoon!