Skip to content

Commit

Permalink
Fixed rotation and scaling in draw_box. fixes #38
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriySalnikov committed Mar 5, 2024
1 parent 0cbafaa commit 9975804
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples_dd3d/DebugDrawDemoScene.gd
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func main_update(delta: float) -> void:

# Boxes
DebugDraw3D.draw_box_xf($Boxes/Box1.global_transform, Color.MEDIUM_PURPLE)
DebugDraw3D.draw_box($Boxes/Box2.global_position, Quaternion.IDENTITY, Vector3.ONE, Color.REBECCA_PURPLE)
DebugDraw3D.draw_box($Boxes/Box2.global_position, Quaternion.from_euler(Vector3(0, deg_to_rad(45), deg_to_rad(45))), Vector3.ONE, Color.REBECCA_PURPLE)
DebugDraw3D.draw_box_xf(Transform3D(Basis(Vector3.UP, PI * 0.25).scaled(Vector3.ONE * 2), $Boxes/Box3.global_position), Color.ROSY_BROWN)

DebugDraw3D.draw_aabb(AABB($Boxes/AABB_fixed.global_position, Vector3(2, 1, 2)), Color.AQUA)
Expand Down
2 changes: 1 addition & 1 deletion examples_dd3d/DebugDrawDemoScene.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ transform = Transform3D(2.90583, -0.000527017, -5.34615, 0.00469241, 3.92788, 0.
rotation_edit_mode = 2

[node name="Box2" type="Node3D" parent="Boxes"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.104528, -0.809874, 2.10804)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.531922, -1.34723, 1.44924)

[node name="Box3" type="Node3D" parent="Boxes"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.34837, -1.08298, 4.36414)
Expand Down
2 changes: 1 addition & 1 deletion examples_dd3d/DebugDrawDemoSceneCS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ void MainUpdate(double delta)

// Boxes
DebugDraw3D.DrawBoxXf(dBox1.GlobalTransform, Colors.MediumPurple);
DebugDraw3D.DrawBox(dBox2.GlobalPosition, Quaternion.Identity, Vector3.One, Colors.RebeccaPurple);
DebugDraw3D.DrawBox(dBox2.GlobalPosition, Quaternion.FromEuler(new Vector3(0, Mathf.DegToRad(45), Mathf.DegToRad(45))), Vector3.One, Colors.RebeccaPurple);
DebugDraw3D.DrawBoxXf(new Transform3D(new Basis(Vector3.Up, Mathf.Pi * 0.25f).Scaled(Vector3.One * 2), dBox3.GlobalPosition), Colors.RosyBrown);

DebugDraw3D.DrawAabb(new Aabb(dAABB_fixed.GlobalPosition, new Vector3(2, 1, 2)), Colors.Aqua);
Expand Down
2 changes: 1 addition & 1 deletion src/3d/debug_draw_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ void DebugDraw3D::draw_cylinder_ab(const Vector3 &a, const Vector3 &b, const rea
void DebugDraw3D::draw_box(const Vector3 &position, const Quaternion &rotation, const Vector3 &size, const Color &color, const bool &is_box_centered, const real_t &duration) {
ZoneScoped;
CHECK_BEFORE_CALL();
draw_box_xf(Transform3D(Basis(rotation).scaled(size), position), color, is_box_centered, duration);
draw_box_xf(Transform3D(Basis(rotation, size), position), color, is_box_centered, duration);
}

void DebugDraw3D::draw_box_ab(const Vector3 &a, const Vector3 &b, const Vector3 &up, const Color &color, const bool &is_ab_diagonal, const real_t &duration) {
Expand Down

0 comments on commit 9975804

Please sign in to comment.