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

[Bug]: Rotation of DebugDraw3D.DrawBox() draws a warped/flattened box. #38

Closed
JakeRabinowitz opened this issue Mar 5, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@JakeRabinowitz
Copy link

Godot version

v4.2.1.stable.mono.official [b09f793f5]

DebugDraw3D version

1.3.1

On which operating systems the error occurs

Windows

Using which renderers the error occurs

No response

Issue description

Applying rotation to DrawBox3D() results in unexpected deformation/warping of the box.

image

Video:

DrawBox3DRotationBug.mp4

Steps to reproduce

  1. Create a new Node3D and attach a new C-Sharp Script to it.
  2. Mark the script as [Tool] and add the following code:
  3.  public override void _Process(double delta)
     {
     	Vector3 size = new Vector3(8, 1, 4);
     	Quaternion rotation = Quaternion.FromEuler(new Vector3(0, 0, 45));
     	DebugDraw3D.DrawBox(Vector3.Zero, rotation, size, new Color(0x00FF00FF), true);
     }

You will see that the box is warped and no longer a rectangle.

Expected Result
The box should be rotated and still rectangular, the same way that a BoxMesh would be.

Minimal reproduction project

DrawBox3DBug.zip

  • Note: You might need to close & reopen the main.tscn for the box to render.
@JakeRabinowitz JakeRabinowitz added the bug Something isn't working label Mar 5, 2024
@DmitriySalnikov
Copy link
Owner

This is the current implementation:
image

And this is what I suppose it should look like?
image

Also, the correct indication of the 45 degree angle is:

var rot = Quaternion.from_euler(Vector3(0, 0, PI/4))
#or
var rot = Quaternion.from_euler(Vector3(0, 0, deg_to_rad(45)))

@JakeRabinowitz
Copy link
Author

Yep, that second image is what I expected it to look like!

Ah right, my mistake on the 45 degrees! Thanks for correcting me.

@DmitriySalnikov
Copy link
Owner

DmitriySalnikov commented Mar 5, 2024

Okay, it turns out there is an additional constructor in C++ that is not in GDScript.
image
image

It was even easier to fix than I thought. 😅

image

@DmitriySalnikov
Copy link
Owner

Later, binaries for testing will appear here.

@JakeRabinowitz
Copy link
Author

Later, binaries for testing will appear here.

Looks like it works! Thanks so much for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants