private void OnDrawGizmos() { #if UNITY_EDITOR if (controlMode == VisualizationColor.Static) { Gizmos.color = new Color(0.529f, 0.808f, 0.922f, 0.6f); } else { Gizmos.color = new Color(0.906f, 0.576f, 0.443f, 0.6f); } // Width and depth of surface float width = transform.lossyScale.x, depth = transform.lossyScale.z; // Project wind on UP/FORWARD plane of wing Vector3 WindProjection = Vector3.ProjectOnPlane(-Wind, transform.right); void renderSurface() { GizmosUtils.DrawPlane(Vector3.zero, new Vector2(width, depth), Color.black); } void renderArrows() { GizmosUtils.DrawArrow(Vector3.zero, DragForce, DragForce.magnitude / GizmosDragDivisor, Color.red); GizmosUtils.DrawArrow(Vector3.zero, LiftForce, LiftForce.magnitude / GizmosLiftDivisor, Color.blue); if (showWorldWind) { GizmosUtils.DrawArrow(Vector3.zero, manager.environment.CalculateWind(transform.position), manager.environment.CalculateWind(transform.position).magnitude, Color.cyan); } if (showFront) { GizmosUtils.DrawArrow(Vector3.zero, transform.forward, 1, Color.yellow); } if (showWind) { GizmosUtils.DrawArrow(-Wind, Wind, Wind.magnitude, Color.green); } if (showWindSpeedFront) { GizmosUtils.DrawLine(transform.forward, WindProjection.normalized, Color.grey); GizmosUtils.DrawArrow(WindProjection, -WindProjection, WindProjection.magnitude, Color.magenta); } } // Render plane with rotation, arrows global space GizmosUtils.SetTR(transform); renderSurface(); GizmosUtils.SetT(transform); renderArrows(); // Render plane static with rotating forces if (showLocalSpaceCopy) { Gizmos.matrix = Matrix4x4.TRS(transform.position + Vector3.right * 4, Quaternion.identity, Vector3.one); renderSurface(); Gizmos.matrix = Matrix4x4.TRS(transform.position + Vector3.right * 4, Quaternion.Inverse(transform.rotation), Vector3.one); renderArrows(); } #endif }