-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Use glam for computing gLTF node transform #11361
Conversation
d8c0ed4
to
3ea71da
Compare
3ea71da
to
d446f7f
Compare
d446f7f
to
524917f
Compare
I've addressed the comment on Also to share a little success story I've had with this: Previously my game used Now, I've wanted to transition to gltf to add more features to the level, to use it as a scene format, I've had so many attempts at this which all failed, as the physics engine handled generating colliders just from meshes, now I realized I need to add all the transforms so the colliders can be properly sized and positioned. When implemented, I was overjoyed but all hope was lost when I found the physics simulation is no longer deterministic. I've made this PR yesterday as a shot in the dark, hoping it would fix the determinism, but had not verified it. Today, I've included this change in my code and am happy to say that the determinism works again! |
Objective
gltf-rs does its own computations when accessing
transform.matrix()
which does not use glam types, rendering #11238 useless if people were to load gltf models and expecting the results to be deterministic across platforms.Solution
Move the computation to bevy side which uses glam types, it was already used in one place, so I created one common function to handle the two cases.
The added benefit this has, is that some gltf files can have translation, rotation and scale directly instead of matrix which skips the transform computation completely, win-win.