public void DrawGizmos() { if (force == null || !isActiveAndEnabled) { return; } Gizmos.matrix = Matrix4x4.TRS(transform.position, transform.rotation, Vector3.one); if (Application.isPlaying) { Vector3 forceVector = force.GetForce(Time.time); float width = forceVector.magnitude * 0.2f; EZSoftBoneUtility.DrawGizmosArrow(Vector3.zero, forceVector, width, Vector3.up); EZSoftBoneUtility.DrawGizmosArrow(Vector3.zero, forceVector, width, Vector3.right); Gizmos.DrawRay(Vector3.zero, forceVector); } else { Vector3 forceVector = new Vector3(0, 0, force.force); float width = force.force * 0.2f; EZSoftBoneUtility.DrawGizmosArrow(Vector3.zero, forceVector, width, Vector3.up); EZSoftBoneUtility.DrawGizmosArrow(Vector3.zero, forceVector, width, Vector3.right); Gizmos.DrawRay(Vector3.zero, forceVector); } Gizmos.DrawWireCube(new Vector3(0, 0, force.force), force.turbulence * 2); }
private void OnDrawGizmosSelected() { Vector3 force0 = GetForce(0) * 50; float width = force0.magnitude * 0.2f; Gizmos.DrawRay(transform.position, force0); EZSoftBoneUtility.DrawGizmosArrow(transform.position, force0, width, transform.up); EZSoftBoneUtility.DrawGizmosArrow(transform.position, force0, width, transform.right); }
public void DrawGizmos(Transform gizmosReference, Transform forceSpace) { Vector3 force0 = GetForce(0, forceSpace) * UnityEditor.HandleUtility.GetHandleSize(gizmosReference.position); float width = force0.magnitude * 0.2f; if (forceSpace == null) { Gizmos.DrawRay(gizmosReference.position, force0); EZSoftBoneUtility.DrawGizmosArrow(gizmosReference.position, force0, width, Vector3.up); EZSoftBoneUtility.DrawGizmosArrow(gizmosReference.position, force0, width, Vector3.right); } else { Gizmos.DrawRay(gizmosReference.position, force0); EZSoftBoneUtility.DrawGizmosArrow(gizmosReference.position, force0, width, gizmosReference.up); EZSoftBoneUtility.DrawGizmosArrow(gizmosReference.position, force0, width, gizmosReference.right); } }
public void DrawGizmos(Vector3 gizmosPosition, Transform forceSpace, float scale) { Vector3 forceVector, turbulenceVector; if (forceSpace != null) { forceVector = forceSpace.TransformDirection(direction) * scale; turbulenceVector = forceSpace.TransformDirection(turbulence) * scale; float width = forceVector.magnitude * 0.2f; EZSoftBoneUtility.DrawGizmosArrow(gizmosPosition, forceVector, width, forceSpace.up); EZSoftBoneUtility.DrawGizmosArrow(gizmosPosition, forceVector, width, forceSpace.right); } else { forceVector = direction * scale; turbulenceVector = turbulence * scale; float width = forceVector.magnitude * 0.2f; EZSoftBoneUtility.DrawGizmosArrow(gizmosPosition, forceVector, width, Vector3.up); EZSoftBoneUtility.DrawGizmosArrow(gizmosPosition, forceVector, width, Vector3.right); } Gizmos.DrawRay(gizmosPosition, forceVector); Gizmos.DrawWireCube(gizmosPosition + forceVector + turbulenceVector * 0.5f, turbulenceVector); }