public static DrawAALine ( Vector3 start, Vector3 end ) : void | ||
start | Vector3 | |
end | Vector3 | |
return | void |
public void OnSceneGUI() { HingeJoint2D target = (HingeJoint2D)this.target; if (target.enabled) { if (target.useLimits) { Vector3 position = Joint2DEditorBase.TransformPoint(target.transform, (Vector3)target.anchor); float num = Mathf.Min(target.limits.min, target.limits.max); float num2 = Mathf.Max(target.limits.min, target.limits.max); float angle = num2 - num; float radius = HandleUtility.GetHandleSize(position) * 0.8f; float rotation = target.GetComponent <Rigidbody2D>().rotation; Vector3 from = (Vector3)Joint2DEditorBase.RotateVector2(Vector3.right, -num2 - rotation); Vector3 end = position + ((Vector3)(Joint2DEditorBase.RotateVector2(Vector3.right, -target.jointAngle - rotation) * radius)); Handles.color = new Color(0f, 1f, 0f, 0.7f); Joint2DEditorBase.DrawAALine(position, end); Handles.color = new Color(0f, 1f, 0f, 0.03f); Handles.DrawSolidArc(position, Vector3.back, from, angle, radius); Handles.color = new Color(0f, 1f, 0f, 0.7f); Handles.DrawWireArc(position, Vector3.back, from, angle, radius); this.DrawTick(position, radius, 0f, from, 1f); this.DrawTick(position, radius, angle, from, 1f); } base.OnSceneGUI(); } }
public new void OnSceneGUI() { HingeJoint2D hingeJoint2D = (HingeJoint2D)this.target; if (!hingeJoint2D.enabled) { return; } if (hingeJoint2D.useLimits) { Vector3 vector = Joint2DEditorBase.TransformPoint(hingeJoint2D.transform, hingeJoint2D.anchor); float num = Mathf.Min(hingeJoint2D.limits.min, hingeJoint2D.limits.max); float num2 = Mathf.Max(hingeJoint2D.limits.min, hingeJoint2D.limits.max); float angle = num2 - num; float num3 = HandleUtility.GetHandleSize(vector) * 0.8f; float rotation = hingeJoint2D.GetComponent <Rigidbody2D>().rotation; Vector3 vector2 = Joint2DEditorBase.RotateVector2(Vector3.right, -num2 - rotation); Vector3 end = vector + Joint2DEditorBase.RotateVector2(Vector3.right, -hingeJoint2D.jointAngle - rotation) * num3; Handles.color = new Color(0f, 1f, 0f, 0.7f); Joint2DEditorBase.DrawAALine(vector, end); Handles.color = new Color(0f, 1f, 0f, 0.03f); Handles.DrawSolidArc(vector, Vector3.back, vector2, angle, num3); Handles.color = new Color(0f, 1f, 0f, 0.7f); Handles.DrawWireArc(vector, Vector3.back, vector2, angle, num3); this.DrawTick(vector, num3, 0f, vector2, 1f); this.DrawTick(vector, num3, angle, vector2, 1f); } base.OnSceneGUI(); }
public new void OnSceneGUI() { SliderJoint2D sliderJoint2D = (SliderJoint2D)this.target; if (!sliderJoint2D.enabled) { return; } Vector3 vector = Joint2DEditorBase.TransformPoint(sliderJoint2D.transform, sliderJoint2D.anchor); Vector3 vector2 = vector; Vector3 vector3 = vector; Vector3 vector4 = Joint2DEditorBase.RotateVector2(Vector3.right, -sliderJoint2D.angle - sliderJoint2D.transform.eulerAngles.z); Handles.color = Color.green; if (sliderJoint2D.useLimits) { vector2 = vector + vector4 * sliderJoint2D.limits.max; vector3 = vector + vector4 * sliderJoint2D.limits.min; Vector3 a = Vector3.Cross(vector4, Vector3.forward); float d = HandleUtility.GetHandleSize(vector2) * 0.16f; float d2 = HandleUtility.GetHandleSize(vector3) * 0.16f; Joint2DEditorBase.DrawAALine(vector2 + a * d, vector2 - a * d); Joint2DEditorBase.DrawAALine(vector3 + a * d2, vector3 - a * d2); } else { vector4 *= HandleUtility.GetHandleSize(vector) * 0.3f; vector2 += vector4; vector3 -= vector4; } Joint2DEditorBase.DrawAALine(vector2, vector3); base.OnSceneGUI(); }
public void OnSceneGUI() { SliderJoint2D target = (SliderJoint2D)this.target; if (target.enabled) { Vector3 position = Joint2DEditorBase.TransformPoint(target.transform, (Vector3)target.anchor); Vector3 vector2 = position; Vector3 vector3 = position; Vector3 lhs = (Vector3)Joint2DEditorBase.RotateVector2(Vector3.right, -target.angle - target.transform.eulerAngles.z); Handles.color = Color.green; if (target.useLimits) { vector2 = position + ((Vector3)(lhs * target.limits.max)); vector3 = position + ((Vector3)(lhs * target.limits.min)); Vector3 vector5 = Vector3.Cross(lhs, Vector3.forward); float num = HandleUtility.GetHandleSize(vector2) * 0.16f; float num2 = HandleUtility.GetHandleSize(vector3) * 0.16f; Joint2DEditorBase.DrawAALine(vector2 + ((Vector3)(vector5 * num)), vector2 - ((Vector3)(vector5 * num))); Joint2DEditorBase.DrawAALine(vector3 + ((Vector3)(vector5 * num2)), vector3 - ((Vector3)(vector5 * num2))); } else { lhs = (Vector3)(lhs * (HandleUtility.GetHandleSize(position) * 0.3f)); vector2 += lhs; vector3 -= lhs; } Joint2DEditorBase.DrawAALine(vector2, vector3); base.OnSceneGUI(); } }
public static void DrawDistanceGizmo(Vector3 anchor, Vector3 connectedAnchor, float distance) { Vector3 normalized = (anchor - connectedAnchor).normalized; Vector3 vector = connectedAnchor + normalized * distance; Vector3 vector2 = Vector3.Cross(normalized, Vector3.forward); vector2 *= HandleUtility.GetHandleSize(connectedAnchor) * 0.16f; Handles.color = Color.green; Joint2DEditorBase.DrawAALine(anchor, vector); Joint2DEditorBase.DrawAALine(connectedAnchor + vector2, connectedAnchor - vector2); Joint2DEditorBase.DrawAALine(vector + vector2, vector - vector2); }
public void OnSceneGUI() { WheelJoint2D target = (WheelJoint2D)this.target; if (target.enabled) { Vector3 position = Joint2DEditorBase.TransformPoint(target.transform, (Vector3)target.anchor); Vector3 start = position; Vector3 end = position; Vector3 vector4 = (Vector3)Joint2DEditorBase.RotateVector2(Vector3.right, -target.suspension.angle - target.transform.eulerAngles.z); Handles.color = Color.green; vector4 = (Vector3)(vector4 * (HandleUtility.GetHandleSize(position) * 0.3f)); start += vector4; end -= vector4; Joint2DEditorBase.DrawAALine(start, end); base.OnSceneGUI(); } }
public new void OnSceneGUI() { WheelJoint2D wheelJoint2D = (WheelJoint2D)this.target; if (!wheelJoint2D.enabled) { return; } Vector3 vector = Joint2DEditorBase.TransformPoint(wheelJoint2D.transform, wheelJoint2D.anchor); Vector3 vector2 = vector; Vector3 vector3 = vector; Vector3 vector4 = Joint2DEditorBase.RotateVector2(Vector3.right, -wheelJoint2D.suspension.angle - wheelJoint2D.transform.eulerAngles.z); Handles.color = Color.green; vector4 *= HandleUtility.GetHandleSize(vector) * 0.3f; vector2 += vector4; vector3 -= vector4; Joint2DEditorBase.DrawAALine(vector2, vector3); base.OnSceneGUI(); }