We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
public static void DrawWireCapsule(Vector3 pos, Quaternion rot, float radius, float height, Color color = default(Color)) { if (color != default(Color)) Handles.color = color; Matrix4x4 angleMatrix = Matrix4x4.TRS(pos, rot, Handles.matrix.lossyScale); using (new Handles.DrawingScope(angleMatrix)) { var pointOffset = (height - (radius * 2)) / 2; //draw sideways Handles.DrawWireArc(Vector3.up * pointOffset, Vector3.left, Vector3.back, -180, radius); Handles.DrawLine(new Vector3(0, pointOffset, -radius), new Vector3(0, -pointOffset, -radius)); Handles.DrawLine(new Vector3(0, pointOffset, radius), new Vector3(0, -pointOffset, radius)); Handles.DrawWireArc(Vector3.down * pointOffset, Vector3.left, Vector3.back, 180, radius); //draw frontways Handles.DrawWireArc(Vector3.up * pointOffset, Vector3.back, Vector3.left, 180, radius); Handles.DrawLine(new Vector3(-radius, pointOffset, 0), new Vector3(-radius, -pointOffset, 0)); Handles.DrawLine(new Vector3(radius, pointOffset, 0), new Vector3(radius, -pointOffset, 0)); Handles.DrawWireArc(Vector3.down * pointOffset, Vector3.back, Vector3.left, -180, radius); //draw center Handles.DrawWireDisc(Vector3.up * pointOffset, Vector3.up, radius); Handles.DrawWireDisc(Vector3.down * pointOffset, Vector3.up, radius); } }
参考资料:https://forum.unity.com/threads/drawing-capsule-gizmo.354634/
The text was updated successfully, but these errors were encountered:
No branches or pull requests
参考资料:https://forum.unity.com/threads/drawing-capsule-gizmo.354634/
The text was updated successfully, but these errors were encountered: