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

Path3D Up Vector miscalculation #81879

Closed
crmsncreates opened this issue Sep 18, 2023 · 3 comments · Fixed by #81885
Closed

Path3D Up Vector miscalculation #81879

crmsncreates opened this issue Sep 18, 2023 · 3 comments · Fixed by #81885

Comments

@crmsncreates
Copy link

Godot version

v4.2.dev4.mono.official [549fcce]

System information

Godot v4.2.dev4.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3080 (NVIDIA; 31.0.15.3619) - Intel(R) Core(TM) i9-10900KF CPU @ 3.70GHz (20 Threads)

Issue description

Since somewhere around 4.1, when a point on a Path3D is moved on the Y-axis, it flips itself and all points after it upside-down:
image

Moving one of the points that come before it on the X-axis seems to fix the problem?
image

Though even this seems to have a few errors here and there: (from the repro project)
record

Expected no flipping, as it worked in previous versions such as v4.0.3.stable.mono.official [5222a99] here:
image

Steps to reproduce

  1. Create a Path3D
  2. Add 2 points at the same Y position
  3. Move one of them on the Y-axis

Minimal reproduction project

PathBug.zip

@akien-mga akien-mga added this to the 4.2 milestone Sep 18, 2023
@rmmh
Copy link
Contributor

rmmh commented Sep 18, 2023

The repro project let me bisect this to 42aa539, part of #72842.

The changes to curve.cpp look relevant.

@TokageItLab, can you have a look?

@kleonc
Copy link
Member

kleonc commented Sep 18, 2023

The repro project let me bisect this to 42aa539, part of #72842.

The changes to curve.cpp look relevant.

Looking at these changes I think this line:

rotate.rotate_to_align(frame_prev.get_column(2), forward);

should have also been changed to accomodate the changed direction, specifically to something like:

rotate.rotate_to_align(-frame_prev.get_column(2), forward);

as -Z basis vector should be now interpreted as forward.

(Haven't tested it at all, just looked at the changed code.)

@rmmh
Copy link
Contributor

rmmh commented Sep 18, 2023

Looking at these changes I think this line:

rotate.rotate_to_align(frame_prev.get_column(2), forward);

should have also been changed to accomodate the changed direction, specifically to something like:

rotate.rotate_to_align(-frame_prev.get_column(2), forward);

This fixes the repro case, I can try to figure out a regression test and make a PR?

YuriSizov pushed a commit to YuriSizov/godot that referenced this issue Sep 20, 2023
The code was modified in 42aa539 to have a different basis vector, but
this line was missed and caused up vectors to invert sometimes.

Fixes godotengine#81879

(cherry picked from commit 734b9d2)
mandryskowski pushed a commit to mandryskowski/godot that referenced this issue Oct 11, 2023
The code was modified in 42aa539 to have a different basis vector, but
this line was missed and caused up vectors to invert sometimes.

Fixes godotengine#81879
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants