Skip to content

jolt physics: to_jolt to use get_rotation_quaternion #103426

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vmbaillie
Copy link

The orthanormalized basis transform from set_transform sometimes has a negative determinant, so instead of calling orthonormalize within that routine, it's called within get_rotation_quaternion.

Fixes #103408

The orthanormalized basis transform from set_transform sometimes has a
negative determinant, so instead of calling orthonormalize within that
routine, it's called within get_rotation_quaternion.
@vmbaillie
Copy link
Author

There may be other places to reduce calculation repetition, best to get an expert to review before any merge

@AThousandShips AThousandShips added this to the 4.5 milestone Mar 1, 2025
@AThousandShips AThousandShips added the cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release label Mar 1, 2025
Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We tend to use get_rotation_quaternion for basis to quaternion conversion. So this seems correct.

Part of the animation team.

@fire fire requested a review from a team March 3, 2025 02:20
Copy link
Contributor

@mihe mihe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely opposed to merging the changes to the conversion function, since it is technically safer this way, but #103440 still seems like a more holistic approach to me, so let's resolve the discussion there first.

However, as hinted at by @vmbaillie already, there are more places than JoltBody3D::set_transform where redundant orthonormalization should be removed in this case, so this is not ready to be merged either way.

Copy link
Contributor

@mihe mihe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With #103440 having been merged, I would consider this PR to be superseded, as the additional work being done in Basis::get_rotation_quaternion compared to Basis::get_quaternion, meaning orthonormalization and ensuring correct handedness, is entirely redundant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release topic:physics topic:3d
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Negative scaling is broken when using Jolt Physics
4 participants