private void DrawRod(Vector3 pos, Quaternion rot) { Vector3 axisX = rot * Vector3.right; Vector3 axisY = rot * Vector3.up; Vector3 axisZ = rot * Vector3.forward; Vector3 offsetX = 0.5f * kRodThickness * axisX; Vector3 offsetY = 0.5f * (kRodLegnth - kRodThickness) * axisY; Vector3 offsetZ = 0.5f * kRodThickness * axisZ; Vector2 dimsSide = new Vector2(kRodThickness, kRodLegnth); Vector2 dimsCap = new Vector2(kRodThickness, kRodThickness); Quaternion q = Quaternion.AngleAxis(90.0f, Vector3.right); Quaternion r = Quaternion.AngleAxis(90.0f, Vector3.up); // sides DebugUtil.DrawRect(pos + offsetZ + offsetY, rot * q, dimsSide, Color.red, true, DebugUtil.Style.FlatShaded); DebugUtil.DrawRect(pos + offsetX + offsetY, rot * r * q, dimsSide, Color.green, true, DebugUtil.Style.FlatShaded); DebugUtil.DrawRect(pos - offsetZ + offsetY, rot * r * r * q, dimsSide, Color.red, true, DebugUtil.Style.FlatShaded); DebugUtil.DrawRect(pos - offsetX + offsetY, rot * r * r * r * q, dimsSide, Color.green, true, DebugUtil.Style.FlatShaded); // caps DebugUtil.DrawRect(pos - (0.5f * kRodThickness) * axisY, rot, dimsCap, Color.yellow, true, DebugUtil.Style.FlatShaded); DebugUtil.DrawRect(pos + (kRodLegnth - 0.5f * kRodThickness) * axisY, rot, dimsCap, Color.yellow, true, DebugUtil.Style.FlatShaded); // rotationAxis DebugUtil.DrawArrow(pos, pos + 1.2f * m_rotDiffAxis, 0.1f, 0.3f, 32, 0.03f, Color.cyan, true, DebugUtil.Style.SmoothShaded); }