godotengine / godotengine/godot

CSGPolygon3D following a Path3D receives double the rotation values of the root node when re-loading a scene.

Open
#87,658 1 comment 0 reactions 0 assignees View on GitHub
bug discussion topic:3d topic:editor
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

Reproduceable in Godot v4.2.1.stable.mono.official [b09f793f5].

### System information

Godot v4.2.1.stable.mono - Windows 10.0.19045 - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 4090 (NVIDIA; 31.0.15.3203) - Intel(R) Core(TM) i7-7820X CPU @ 3.60GHz (16 Threads)

### Issue description

CSGPolygon3Ds that are assigned to follow a Path3D are not behaving as expected when rotating their root nodes. They behave as expected when initial changes are made to parent node rotations, but when reloading the scene or another scene that contains the CSGPolygon3D's scene, the rotation of the CSGPolygon3D is double that of the root. For example, the CSGPolygon3D in this playfield scene with no rotation is fine
![image](https://github.com/godotengine/godot/assets/44176450/9ab3e1ca-1bc3-4675-aa40-c2fe85920621)
but when I load the playfield scene into my physics test scene, rotate it and then reload the scene, the result is that the CSGPolygon3D is rotated around the playfield's origin double the amount it is supposed to be
![image](https://github.com/godotengine/godot/assets/44176450/93abdc2f-6bc2-43a6-abe6-bf8009f92d41)

This issue occurs both when a scene containing the CSGPolygon3D is loaded in another scene, or if the scene itself is loaded with a rotated root Node3D.

### Steps to reproduce

1. Create a new 3D Scene.
2. Add a Path3D node as a child to the root Node3D.
3. Create a simple path.
4. Add a CSGPolygon3D node as a child to the root Node3D.
5. Change the CSGPolygon3D's mode to Path.
6. Assign the Path3D node that was created in step 2 to the CSGPolygon3D's Path Node property.
7. Rotate the root Node3D some arbitrary amount, such that it is obvious which way the CSGPolygon3D should be moving.
8. Save, close and reload the scene.
9. The CSGPolygon3D will now be rotated double what it should be (i.e. if the Node3D was rotated around the Z-axis by 45 degrees, the CSGPolygon3D will appear to have been rotated 90 degrees around the Z-axis)

### Minimal reproduction project (MRP)

[CSGPolygon3D Bug Report.zip](https://github.com/godotengine/godot/files/14074182/CSGPolygon3D.Bug.Report.zip)

Open the project, load the "node_3d" scene in the project root. Observe that even though the Node3D is only rotated 45 degrees around the Z-axis and no other nodes have any rotation, the CSGPolygon3D is rotated 90 degrees around the Z-axis. Also observe that the CSGPolygon3D no longer follows the Path3D, which is properly rotated at 45 degrees. Set the Node3D's rotation to 0,0,0, save the scene and re-open it to see the CSGPolygon3D is now back in the correct position with no rotation.

Contributor guide

Open the contributing guide

Research direction

Open the linked minimal reproduction project and load the root node_3d scene, then reproduce the reload after rotating the root Node3D. Investigate the interaction between the Path3D and CSGPolygon3D nodes; done means the CSGPolygon3D keeps the expected single root rotation and continues following the path after reloading.

Written by the indexing model from the issue text.

Assessment

Domain
computer-graphics, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.