Debug Manager for Torque X 3D
by AIDan · in Torque X 3D · 05/23/2009 (10:44 am) · 6 replies
Because Torque X 3D lacks the ability to draw proper debug data I decided to implement that myself.

The debug manager allows you to draw different shapes as well as text. All debug output can be timed so the output can be shown for a few seconds if you want. Also the debug manager is thread safe so you can draw stuff from where ever you want.
The following shapes are supported:
Boxes, Circles, Cones, Cylinders, Lines, Points, Rectangles, Spheres and Triangles
Each shape comes with many different overloads so it is as easy as possible to use them.
The output of the debug manager is also cached so when the game becomes inactive the debug data is still drawn.
The debug manager must be added to your scene just like the rigid manager is:
To use the debug manager all you have to do is this:
The debug manager can de downloaded here:
nextgenai.com/images/DebugManager.cs
Feedback is always appreciated.
Here is a list of all available overloads:

The debug manager allows you to draw different shapes as well as text. All debug output can be timed so the output can be shown for a few seconds if you want. Also the debug manager is thread safe so you can draw stuff from where ever you want.
The following shapes are supported:
Boxes, Circles, Cones, Cylinders, Lines, Points, Rectangles, Spheres and Triangles
Each shape comes with many different overloads so it is as easy as possible to use them.
The output of the debug manager is also cached so when the game becomes inactive the debug data is still drawn.
The debug manager must be added to your scene just like the rigid manager is:
<TorqueSceneData>
<Objects>
...
<DebugManager type="StarterGame.DebugManager" name="DebugManager" />
...
</Objects>
<TorqueSceneData>To use the debug manager all you have to do is this:
// position, extent, color, lifetime new DebugManager.Box(new Vector3(-1000.0f, 0.0f, 0.0f), new Vector3(50.0f, 100.0f, 20.0f), Color.Goldenrod, 0.0f);
The debug manager can de downloaded here:
nextgenai.com/images/DebugManager.cs
Feedback is always appreciated.
Here is a list of all available overloads:
Line(Vector3 begin, Vector3 end, Color color, float lifetime) Line(Vector3 begin, Vector3 direction, float length, Color color, float lifetime) Rectangle(Vector3 position, Vector3 facingDirection, float extentX, float extentY, Color color, float lifetime) Rectangle(Vector3 position, Quaternion rotation, float extentX, float extentY, Color color, float lifetime) Rectangle(Matrix transform, float extentX, float extentY, Color color, float lifetime) Triangle(Vector3 position, Vector3 facingDirection, float extentX, float extentY, Color color, float lifetime) Triangle(Vector3 position, Quaternion rotation, float extentX, float extentY, Color color, float lifetime) Triangle(Matrix transform, float extentX, float extentY, Color color, float lifetime) Point(Vector3 position, float extent, Color color, float lifetime) Point(Matrix transform, float extent, Color color, float lifetime) Box(Vector3 position, Vector3 extent, Color color, float lifetime) Box(Matrix transform, Vector3 extent, Color color, float lifetime) Box(Vector3 position, Quaternion rotation, Vector3 extent, Color color, float lifetime) Box(Vector3 position, Vector3 forward, Vector3 up, Vector3 extent, Color color, float lifetime) Circle(Vector3 position, Vector3 facingDirection, float radiusX, float radiusY, int sides, Color color, float lifetime) Circle(Vector3 position, Quaternion rotation, float radiusX, float radiusY, int sides, Color color, float lifetime) Circle(Matrix transform, float radiusX, float radiusY, int sides, Color color, float lifetime) Cylinder(Vector3 position, Vector3 facingDirection, Vector3 extent, int sides, Color color, float lifetime) Cylinder(Vector3 position, Quaternion rotation, Vector3 extent, int sides, Color color, float lifetime) Cylinder(Matrix transform, Vector3 extent, int sides, Color color, float lifetime) Cylinder(Vector3 position, Vector3 facingDirection, float beginExtentX, float beginExtentY, float endExtentX, float endExtentY, float heightExtent, int sides, Color color, float lifetime) Cylinder(Vector3 position, Quaternion rotation, float beginExtentX, float beginExtentY, float endExtentX, float endExtentY, float heightExtent, int sides, Color color, float lifetime) Cylinder(Matrix transform, float beginExtentX, float beginExtentY, float endExtentX, float endExtentY, float heightExtent, int sides, Color color, float lifetime) Cylinder(Vector3 begin, Vector3 end, float beginExtentX, float beginExtentY, float endExtentX, float endExtentY, int sides, Color color, float lifetime) Cone(Vector3 position, Vector3 facingDirection, Vector3 extent, int sides, Color color, float lifetime) Cone(Vector3 position, Quaternion rotation, Vector3 extent, int sides, Color color, float lifetime) Cone(Matrix transform, Vector3 extent, int sides, Color color, float lifetime) Cone(Vector3 begin, Vector3 end, float radiusX, float radiusY, int sides, Color color, float lifetime) Sphere(Vector3 position, Vector3 extent, int sides, Color color, float lifetime) Sphere(Matrix transform, Vector3 extent, int sides, Color color, float lifetime) Text(Vector3 position, string text, Color color, float lifetime)
About the author
#2
But to be fair, I also know some commercial support, those you pay for, and these are not necessarily better. Of course support can always be better, but for paying a relatively small fee once the support here is quite okay. I am sure it will become better when most of the bugs of the first release have been dealt with and there are more people around who have experience with the engine.
We just have to keep on so following generations of programmers have an easier life :P
05/25/2009 (11:37 pm)
Haha thanks.But to be fair, I also know some commercial support, those you pay for, and these are not necessarily better. Of course support can always be better, but for paying a relatively small fee once the support here is quite okay. I am sure it will become better when most of the bugs of the first release have been dealt with and there are more people around who have experience with the engine.
We just have to keep on so following generations of programmers have an easier life :P
#3
05/26/2009 (4:26 am)
I started in the age of assembler. Ok well it was the late 80's, but assembler was still fun. I guess I'm spoilt by C# these days!
#4
05/26/2009 (4:29 am)
btw, I really like the background in that picture...
#5
But as a programmer I have to rely on ripped assets :(
05/26/2009 (4:41 am)
Yeah it is from the skybox I use. I am doing a space game prototype, that's why.But as a programmer I have to rely on ripped assets :(
#6
I followed a few tutorials for photo shop and did some backgrounds, but I need to go back and do some lower res versions, and then some how learn to make them into cube maps. I have a friend making me some models, but of course 1 person making models in between day job and family is like 1 programmer making a game in between day job and family.
05/26/2009 (3:09 pm)
I'm doing a space game too (have been for um, probably 9 years or so on and off), which is why I've always been reluctant to use Torque, mostly because it's easy to crash when you start removing the terrain and sky and sun... Though TX seems to be coping with that at the moment.I followed a few tutorials for photo shop and did some backgrounds, but I need to go back and do some lower res versions, and then some how learn to make them into cube maps. I have a friend making me some models, but of course 1 person making models in between day job and family is like 1 programmer making a game in between day job and family.
Torque Owner Trent