Skip to content

Commit f397750

Browse files
authored
Fixed OBB DrawDebugShape (#527)
* Cleaned up mod communications, and added new message type * Removed debug logs * Fixed OBB * Changed back to real mod
1 parent c0d369c commit f397750

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

‎Torch.Mod/Messages/ShowDebugShape.cs‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,14 @@ public override void ProcessServer()
7171

7272

7373

74-
public void addOBB(BoundingBoxD box, Quaternion orientation, Color color, MySimpleObjectRasterizer raster, float intensity, float linethickness)
74+
public void addOBB(BoundingBoxD box, Vector3D position, Vector3D forward, Vector3D up, Color color, MySimpleObjectRasterizer raster, float intensity, float linethickness)
7575
{
7676
drawObject obj = new drawObject(drawObject.drawtype.OBB);
7777

7878
obj.box = box;
79-
obj.orientation = orientation;
79+
obj.position = position;
80+
obj.forward = forward;
81+
obj.up = up;
8082
obj.color= color;
8183
obj.intensity = intensity;
8284
obj.linethickness = linethickness;
@@ -161,7 +163,10 @@ public drawObject() { }
161163
public BoundingBoxD box;
162164

163165
[ProtoMember(105)]
164-
public Quaternion orientation;
166+
public Vector3D forward;
167+
168+
[ProtoMember(106)]
169+
public Vector3D up;
165170

166171

167172
[ProtoMember(120)]
@@ -200,10 +205,9 @@ public void update()
200205

201206
public void drawOBB()
202207
{
203-
var transform = MatrixD.CreateFromQuaternion(orientation);
208+
MatrixD worldMatrix = MatrixD.CreateWorld(position, forward, up);
204209
var material = TorchModCore.id;
205-
MySimpleObjectDraw.DrawTransparentBox(ref transform, ref box, ref color, raster, 1, linethickness, material, material);
206-
210+
MySimpleObjectDraw.DrawTransparentBox(ref worldMatrix, ref box, ref color, raster, 1, linethickness, material, material);
207211
}
208212

209213
public void drawSphere()
@@ -216,6 +220,8 @@ public void drawSphere()
216220

217221

218222

223+
224+
219225
}
220226

221227
}

0 commit comments

Comments
 (0)