Class PhysicsDebugDisplaySystem
A system which is responsible for drawing physics debug display data. Create a singleton entity with PhysicsDebugDisplayData and select what you want to be drawn.
If you want custom debug draw, you need to:
1) Create a system which updates before PhysicsDebugDisplaySystem.
2) In OnUpdate() of that system, call GetSingleton PhysicsDebugDisplayData (even if you are not using it, it is important to do so to properly chain dependencies).
3) Afterwards, in OnUpdate() or in scheduled jobs, call one of the exposed draw methods (Line, Arrow, Plane, Triangle, Cone, Box, ...).
4) Data will be drawn when PhysicsDebugDisplaySystem's OnUpdate() is called.
IMPORTANT: Drawing works only in Editor mode.
Inherited Members
Namespace: Unity.Physics.Authoring
Syntax
public abstract class PhysicsDebugDisplaySystem : SystemBase
Methods
Arc(float3, float3, float3, Single, ColorIndex)
Draws an arc.
Declaration
public static void Arc(float3 center, float3 normal, float3 arm, float angle, ColorIndex color)
Parameters
Type | Name | Description |
---|---|---|
float3 | center | World space position of the arc center. |
float3 | normal | Arc normal. |
float3 | arm | Arc arm. |
Single | angle | Arc angle. |
ColorIndex | color | Color. |
Arrow(float3, float3, ColorIndex)
Draws an arrow.
Declaration
public static void Arrow(float3 x, float3 v, ColorIndex color)
Parameters
Type | Name | Description |
---|---|---|
float3 | x | World space position of the arrow base. |
float3 | v | Arrow direction with length. |
ColorIndex | color | Color. |
Box(float3, float3, quaternion, ColorIndex)
Draws a box.
Declaration
public static void Box(float3 Size, float3 Center, quaternion Orientation, ColorIndex color)
Parameters
Type | Name | Description |
---|---|---|
float3 | Size | Size of the box. |
float3 | Center | Center of the box in world space. |
quaternion | Orientation | Orientation of the box in world space. |
ColorIndex | color | Color. |
Cone(float3, float3, Single, ColorIndex)
Draws a cone.
Declaration
public static void Cone(float3 point, float3 axis, float angle, ColorIndex color)
Parameters
Type | Name | Description |
---|---|---|
float3 | point | Point in world space. |
float3 | axis | Cone axis. |
Single | angle | Cone angle. |
ColorIndex | color | Color. |
Line(float3, float3, ColorIndex)
Draws a line between 2 points.
Declaration
public static void Line(float3 x0, float3 x1, ColorIndex color)
Parameters
Type | Name | Description |
---|---|---|
float3 | x0 | Point 0 in world space. |
float3 | x1 | Point 1 in world space. |
ColorIndex | color | Color. |
Plane(float3, float3, ColorIndex)
Draws a plane.
Declaration
public static void Plane(float3 x, float3 v, ColorIndex color)
Parameters
Type | Name | Description |
---|---|---|
float3 | x | Point in world space. |
float3 | v | Normal. |
ColorIndex | color | Color. |
Point(float3, Single, ColorIndex)
Draws a point.
Declaration
public static void Point(float3 x, float size, ColorIndex color)
Parameters
Type | Name | Description |
---|---|---|
float3 | x | World space position. |
Single | size | Extents. |
ColorIndex | color | Color. |
Triangle(float3, float3, float3, float3, ColorIndex)
Draws a triangle.
Declaration
public static void Triangle(float3 vertex0, float3 vertex1, float3 vertex2, float3 normal, ColorIndex color)
Parameters
Type | Name | Description |
---|---|---|
float3 | vertex0 | Vertex 0 in world space. |
float3 | vertex1 | Vertex 1 in world space. |
float3 | vertex2 | Vertex 2 in world space. |
float3 | normal | Triangle normal. |
ColorIndex | color | Color. |