public static Disc ( |
||
rotation | The rotation of the disc. | |
position | Vector3 | The center of the disc. |
axis | Vector3 | The axis to rotate around. |
size | float | The size of the disc in world space. |
cutoffPlane | bool | If true, only the front-facing half of the circle is draw / draggable. This is useful when you have many overlapping rotation axes (like in the default rotate tool) to avoid clutter. |
snap | float | The grid size to snap to. |
return |
private void DrawSingleCollision(PhysicsDebugDraw.VisContactPoint contactPoint, Color impulseColor, bool useRandomColor) { var primaryColor = useRandomColor ? GetHashedColor(contactPoint.thisColliderInstanceID) : PhysicsVisualizationSettings.contactColor; var inverseColor = useRandomColor ? GetInverseColor(primaryColor) : PhysicsVisualizationSettings.contactSeparationColor; var colliderScale1 = GetColliderScale(contactPoint.thisCollider); var colliderScale2 = GetColliderScale(contactPoint.otherCollider); var colliderScale = Mathf.Min(colliderScale1, colliderScale2); Handles.color = primaryColor; Handles.ArrowHandleCap(0, contactPoint.point, Quaternion.LookRotation(contactPoint.normal), colliderScale, EventType.Repaint); if (PhysicsVisualizationSettings.showContactSeparation && contactPoint.separation > 0.01f) { Vector3 p2 = contactPoint.point - (contactPoint.normal * contactPoint.separation); Handles.color = inverseColor; // The line that displays the separation Handles.DrawLine(p2, contactPoint.point, 2f); Handles.Disc(Quaternion.identity, contactPoint.point , contactPoint.normal, contactPoint.separation / 2f, false, 1f); // Looks really good but maybe computationally too expensive? var discFillingColor = inverseColor; discFillingColor.a = 0.2f; Handles.color = discFillingColor; Handles.DrawSolidDisc(contactPoint.point, contactPoint.normal, contactPoint.separation / 2f); } // Impulse arrow if (PhysicsVisualizationSettings.showContactImpulse && contactPoint.impulse.sqrMagnitude > 0.001f) { Handles.color = impulseColor; Handles.ArrowHandleCap(0, contactPoint.point, Quaternion.LookRotation(contactPoint.impulse), contactPoint.impulse.magnitude, EventType.Repaint); } }