public static void LineCast(RaycastHit hit, Ray ray, float radius, float distance, DebugStyle setup) { if (hit.transform == null) { LineCast(ray, radius, distance, setup); return; } { var prim = new DebugPrimitiveSetup(DebugPrimitiveType.Point, setup); prim.pos = hit.point; prim.rot = Quaternion.LookRotation(hit.normal); prim.extents = vec3(radius * 2); DebugDisplayRegistry.Add(prim); } var place0 = DebugPlace.AToB(ray.origin, ray.origin + ray.direction * hit.distance); { var prim = new DebugPrimitiveSetup(DebugPrimitiveType.LineCast, setup); prim.pos = place0.Position; prim.rot = place0.Rotation; prim.extents = vec3(radius, radius, place0.Extents.z); DebugDisplayRegistry.Add(prim); } var place1 = DebugPlace.AToB(place0.End, ray.origin + ray.direction * distance); { setup.Color = Color.grey; var prim = new DebugPrimitiveSetup(DebugPrimitiveType.LineCast, setup); prim.pos = place1.Position; prim.rot = place1.Rotation; prim.extents = vec3(radius * 0.9f, radius * 0.9f, place1.Extents.z); DebugDisplayRegistry.Add(prim); } }
public static void SphereCast(RaycastHit hit, Ray ray, float radius, float distance, DebugStyle setup) { { var prim = new DebugPrimitiveSetup(DebugPrimitiveType.Point, setup); prim.pos = hit.point; prim.rot = Quaternion.LookRotation(hit.normal); prim.extents = vec3(radius * 0.4f); DebugDisplayRegistry.Add(prim); } var place0 = DebugPlace.AToB(ray.origin, ray.origin + ray.direction * (hit.distance + radius)); { var prim = new DebugPrimitiveSetup(DebugPrimitiveType.SphereCast, setup); prim.pos = place0.Position; prim.rot = place0.Rotation; prim.extents = vec3(radius, radius, place0.Extents.z); DebugDisplayRegistry.Add(prim); } var place1 = DebugPlace.AToB(place0.End - ray.direction * radius * 1.9f, ray.origin + ray.direction * distance); { setup.Color = Color.grey; var prim = new DebugPrimitiveSetup(DebugPrimitiveType.SphereCast, setup); prim.pos = place1.Position; prim.rot = place1.Rotation; prim.extents = vec3(radius * 0.9f, radius * 0.9f, place1.Extents.z); DebugDisplayRegistry.Add(prim); } }
public static void Box(DebugPlace place, DebugStyle setup) { var prim = new DebugPrimitiveSetup(DebugPrimitiveType.Box, setup); prim.pos = place.Position; prim.rot = place.Rotation; prim.extents = place.Extents; DebugDisplayRegistry.Add(prim); }
public static void Point(DebugPlace place, DebugStyle setup) { var prim = new DebugPrimitiveSetup(DebugPrimitiveType.Point, setup); prim.pos = place.Position; prim.rot = Quaternion.identity; prim.extents = place.Extents; DebugDisplayRegistry.Add(prim); }
public static void Line(DebugPlace place, DebugStyle setup) { var prim = new DebugPrimitiveSetup(DebugPrimitiveType.Line, setup); prim.pos = place.Start; prim.rot = place.Rotation; prim.extents = place.Size; DebugDisplayRegistry.Add(prim); }
public static void Arrow(DebugPlace place, DebugStyle setup) { var prim = new DebugPrimitiveSetup(DebugPrimitiveType.Arrow, setup); prim.pos = place.Start; prim.rot = place.Rotation; prim.extents = vec3(place.Extents.x, place.Extents.y, place.Size.z); DebugDisplayRegistry.Add(prim); }
///--------------------------------------------------------------------- //Point: Three line to mark each axis private static void Line(Vector3 start, Vector3 end, DebugStyle setup) { var dir = end - start; var prim = new DebugPrimitiveSetup(DebugPrimitiveType.Line, setup); prim.pos = start; prim.rot = Quaternion.LookRotation(dir.normalized); prim.extents = vec3(0, 0, dir.magnitude); DebugDisplayRegistry.Add(prim); }
public static void SphereCast(Ray ray, float radius, float distance, DebugStyle setup) { var place = DebugPlace.AToB(ray.origin, ray.origin + ray.direction * distance); var prim = new DebugPrimitiveSetup(DebugPrimitiveType.SphereCast, setup); prim.pos = place.Position; prim.rot = place.Rotation; prim.extents = vec3(radius, radius, place.Extents.z); DebugDisplayRegistry.Add(prim); }
public static void Pie(DebugPlace place, Vector2 degrees, DebugStyle setup) { var prim = new DebugPrimitiveSetup(DebugPrimitiveType.Pie, setup); prim.pos = place.Position; prim.rot = place.Rotation; prim.extents = place.Extents; prim.range = degrees; DebugDisplayRegistry.Add(prim); }
public static void Plane(Plane plane, DebugPlace place, DebugStyle setup) { var q = place.Rotation; var x = place.Right; var y = place.Up; var p = (plane.normal * -plane.distance) + (x * place.Position.x) + (y * place.Position.y); var prim = new DebugPrimitiveSetup(DebugPrimitiveType.Plane, setup); prim.pos = p; prim.rot = q; prim.extents = place.Size; DebugDisplayRegistry.Add(prim); Arrow(place, setup); }
///--------------------------------------------------------------------- protected static void Add(DebugPrimitiveSetup debugPrimitive) { DebugDisplayRegistry.Add(debugPrimitive); }
///----------------------------------------------------------------- public DebugDisplayFrame(DebugDisplayRegistry owner) { this.owner = owner; framePrimitives = new List <DebugPrimitiveSetup>(); }