Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import: AnimatedTriangle sample model doesn't rotate around a complete circle #254

Closed
scurest opened this issue Jan 25, 2019 · 4 comments
Closed
Labels
bug Something isn't working importer This involves or affects the import process

Comments

@scurest
Copy link
Contributor

scurest commented Jan 25, 2019

AnimatedTriangle has an issue with antipodal quaternions, cf. KhronosGroup/glTF-Sample-Models#185 and KhronosGroup/glTF#1395.

The way I solved this was to

for i in range(1, len(quaternions)):
    if quaternions[i].dot(quaternions[i-1]) < 0:
        quaternions[i] = -quaternions[i]
@julienduroure julienduroure added bug Something isn't working importer This involves or affects the import process labels Jan 25, 2019
@julienduroure
Copy link
Collaborator

Fixed by 28e731e

@scurest
Copy link
Contributor Author

scurest commented Jan 31, 2019

There's the same problem for joint animation though.

Rotate.zip

You can probably replace the round-trip through Eulers with that loop too, since round-tripping through Eulers only changes the sign of the quaternion, and that loop fully determines all the signs.

@julienduroure julienduroure reopened this Jan 31, 2019
@julienduroure
Copy link
Collaborator

ReOpened for bone management

@scurest
Copy link
Contributor Author

scurest commented Feb 4, 2019

@julienduroure That's still not right.

When you convert quaternions to Eulers or matrices, you lose the information about whether you had q or -q, so flipping signs before you do that is totally useless. It works for that test file only because it happens to go down the if not node.parent branch so it doesn't go through matrices/Eulers. Here's a file that goes down the else branch and still has the problem.

You should do that loop as the last step, to final_rots just before you call fill_fcurves. And I'm pretty sure if you do that you don't need the Euler round-trip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working importer This involves or affects the import process
Projects
None yet
Development

No branches or pull requests

2 participants