DmitriySalnikov / godot_debug_draw_3d

Draw 3D debug graphics and 2D overlays with this add-on.

Home Page:https://dd3d.dmitriysalnikov.ru/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

JakeRabinowitz opened this issue · comments

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.

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)))

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

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

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

Later, binaries for testing will appear here.

Later, binaries for testing will appear here.

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