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

CSGPolygon in Path mode does not take the curve's tilt property into account #65634

Closed
AzedaxenSoftware opened this issue Sep 10, 2022 · 6 comments · Fixed by #79355
Closed

Comments

@AzedaxenSoftware
Copy link

Godot version

3.5.stable

System information

Pop!_OS 22.04

Issue description

When using a CSGPolygon in Path mode, the resulting geometry does not use the tilt property of the given Curve's points. This happens even when the polygon's Rotation Mode is set to PathFollow. PathFollow nodes do follow the tilt of a curve when their Rotation Mode is set to Oriented, so this behavior seems inconsistent.

In this example, I have a straight curve with two points; the first one with a tilt of 0 degrees, and the second with a tilt of 180 degrees. In this case, this is the expected shape:
expected
However, this is the actual resulting shape:
actual

Steps to reproduce

  1. Create a Path node and give it a Curve with some points. Assign a tilt to these points.
  2. Create a CSGPolygon node and set its mode to Path. Assign the previously created Path node to the CSGPolygon's Path property.

The repro project contains a scene with a Path, a CSGPolygon and a PathFollow node, along with some primitive meshes to visualize the tilt of the curve's points. Both the CSGPolygon and the PathFollow are assigned to the same Path node, which has the same curve that was detailed above. By adjusting the PathFollow's offset, you can see how it rotates along the curve. Notice how the CSGPolygon is shaped as if the Curve has no tilt.

Minimal reproduction project

csgpolygon_tilt.zip

@NathanielEssenberg
Copy link

This also happens in Godot 4.0 (last I tried was beta 7)

@pidogs
Copy link
Contributor

pidogs commented May 19, 2023

I am also still getting this bug in v4.0.2.stable.official

@nickpolet
Copy link

Has there been any update on this? Having this functionality really opens up a lot for racing games etc... by being able to control the mesh nicely along a path.

The latest 4.1 build on master has this issue.

@pidogs
Copy link
Contributor

pidogs commented Jul 11, 2023

Tilting has been fixed in the pull request #68873 and it is slated to be added to the 4.2 release.

If you want a quick fix you can compile your own, only one line needs to be changed.

In modules/csg/csg_shape.cpp on line 2023.

current_up = curve->sample_baked_up_vector(current_offset);

should be changed to

current_up = curve->sample_baked_up_vector(current_offset,true);

Hope this helps.

:)

@akien-mga
Copy link
Member

If that's the only change needed to fix this bug specifically, this might be worth submitting as a separate pull request. #68873 seems to have a bigger scope, adding a new feature, and might take longer to review than a pure bugfix PR.

@pidogs
Copy link
Contributor

pidogs commented Jul 11, 2023

I made a pull request #79355.
Hopefully, I did everything correctly as this is my first pull request.

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.

7 participants