Class PhysicsDebugDisplaySystem
A system which is responsible for drawing physics debug display data.
Create a singleton entity with Physics
If you want custom debug draw, you need to:
- Create a system which updates before PhysicsDebugDisplaySystem.
- In OnUpdate() of that system, call GetSingleton Physics
Debug (even if you are not using it, it is important to do so to properly chain dependencies).Display Data - Afterwards, in OnUpdate() or in scheduled jobs, call one of the exposed draw methods (Line, Arrow, Plane, Triangle, Cone, Box, ...).
IMPORTANT: Drawing works only in the Editor.
Inherited Members
Namespace: Unity.Physics.Authoring
Assembly: Unity.Physics.Hybrid.dll
Syntax
public abstract class PhysicsDebugDisplaySystem : SystemBase
Methods
Arc(float3, float3, float3, float, 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. |
float | angle | Arc angle. |
Color |
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. |
Color |
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. |
Color |
color | Color. |
Cone(float3, float3, float, 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. |
float | angle | Cone angle. |
Color |
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. |
Color |
color | Color. |
Lines(in NativeArray<float3>, ColorIndex)
Draws multiple lines between the provided pairs of points.
Declaration
public static void Lines(in NativeArray<float3> lineVertices, ColorIndex color)
Parameters
Type | Name | Description |
---|---|---|
Native |
lineVertices | An array of vertices containing a sequence of point pairs. A line is drawn between every pair of points. |
Color |
color | Color. |
Lines(in NativeList<float3>, ColorIndex)
Draws multiple lines between the provided pairs of points.
Declaration
public static void Lines(in NativeList<float3> lineVertices, ColorIndex color)
Parameters
Type | Name | Description |
---|---|---|
Native |
lineVertices | A list of vertices containing a sequence of point pairs. A line is drawn between every pair of points. |
Color |
color | Color. |
Lines(float3*, int, ColorIndex)
Draws multiple lines between the provided pairs of points.
Declaration
public static void Lines(float3* lineVertices, int numVertices, ColorIndex color)
Parameters
Type | Name | Description |
---|---|---|
float3* | lineVertices | A pointer to a vertices array containing a sequence of point pairs. A line is drawn between every pair of points. |
int | numVertices | Number of vertices. |
Color |
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. |
Color |
color | Color. |
Point(float3, float, ColorIndex)
Draws a point.
Declaration
public static void Point(float3 x, float size, ColorIndex color)
Parameters
Type | Name | Description |
---|---|---|
float3 | x | World space position. |
float | size | Extents. |
Color |
color | Color. |
TriangleEdges(in NativeArray<float3>, in NativeArray<int>, ColorIndex)
Draws multiple triangles from the provided data arrays.
Declaration
public static void TriangleEdges(in NativeArray<float3> vertices, in NativeArray<int> triangleIndices, ColorIndex color)
Parameters
Type | Name | Description |
---|---|---|
Native |
vertices | An array of vertices. |
Native |
triangleIndices | An array of triangle indices pointing into the vertices array. A triangle is drawn from every triplet of triangle indices. |
Color |
color | Color. |
Triangles(in NativeArray<float3>, in NativeArray<int>, ColorIndex)
Draws multiple triangles from the provided data arrays.
Declaration
public static void Triangles(in NativeArray<float3> vertices, in NativeArray<int> triangleIndices, ColorIndex color)
Parameters
Type | Name | Description |
---|---|---|
Native |
vertices | An array of vertices. |
Native |
triangleIndices | An array of triangle indices pointing into the vertices array. A triangle is drawn from every triplet of triangle indices. |
Color |
color | Color. |
Triangles(in NativeArray<float3>, ColorIndex)
Draws multiple triangles from the provided array of triplets of vertices.
Declaration
public static void Triangles(in NativeArray<float3> vertices, ColorIndex color)
Parameters
Type | Name | Description |
---|---|---|
Native |
vertices | An array containing a sequence of vertex triplets. A triangle is drawn from every triplet of vertices. |
Color |
color | Color. |
Triangles(in NativeList<float3>, ColorIndex)
Draws multiple triangles from the provided list of triplets of vertices.
Declaration
public static void Triangles(in NativeList<float3> vertices, ColorIndex color)
Parameters
Type | Name | Description |
---|---|---|
Native |
vertices | A list containing a sequence of vertex triplets. A triangle is drawn from every triplet of vertices. |
Color |
color | Color. |
Triangles(float3*, int, ColorIndex)
Draws multiple triangles from the provided array of triplets of vertices.
Declaration
public static void Triangles(float3* vertices, int numVertices, ColorIndex color)
Parameters
Type | Name | Description |
---|---|---|
float3* | vertices | An array containing a sequence of vertex triplets. A triangle is drawn from every triplet of vertices. |
int | numVertices | Number of vertices. |
Color |
color | Color. |