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

Fix Rotation change detection triggering every frame #272

Merged
merged 3 commits into from
Dec 3, 2023

Conversation

Jondolf
Copy link
Owner

@Jondolf Jondolf commented Dec 3, 2023

Objective

Currently, Rotation changes are triggered every frame for non-sleeping dynamic bodies because of an incorrect quaternion comparison.

Solution

Change the delta != Quaternion::IDENTITY check to be delta.w != 0.0 in integrator.rs line 231. Checking w should be enough because it's the angle of the rotation around the rotation axis.

@Jondolf Jondolf added the bugfix label Dec 3, 2023
@Jondolf Jondolf merged commit 3a7559b into main Dec 3, 2023
4 checks passed
@Jondolf Jondolf deleted the fix-rotation-change-detection branch December 3, 2023 20:17
Jondolf added a commit that referenced this pull request Dec 27, 2023
# Objective

In #272, the integrator was changed to update rotation only if `delta.w != 0.0`. However, in some cases, x, y, or z can be non-zero even if w is zero, like with `AngularVelocity(Vec3::X)`, and in those cases the rotation would incorrectly be ignored.

## Solution

Make the condition stricter by also checking if x, y, and z are 0. Based on a quick test, this should also keep change detection working, which is what #272 was trying to address.
@Jondolf Jondolf added C-Bug Something isn't working and removed bugfix labels Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant