| 71 | #include "Engine/Debug/DebugDraw.h" |
| 72 | |
| 73 | void DistanceJoint::OnDebugDrawSelected() |
| 74 | { |
| 75 | const Vector3 source = GetPosition(); |
| 76 | const Vector3 target = GetTargetPosition(); |
| 77 | Vector3 dir = target - source; |
| 78 | const float len = (float)dir.Length(); |
| 79 | dir *= 1.0f / len; |
| 80 | Vector3 start = source, end = target; |
| 81 | float max = 0, min = 0; |
| 82 | if (EnumHasAnyFlags(_flags, DistanceJointFlag::MinDistance)) |
| 83 | { |
| 84 | min = Math::Min(_minDistance, len); |
| 85 | start += dir * min; |
| 86 | DEBUG_DRAW_LINE(source, start, Color::Red * 0.6f, 0, false); |
| 87 | } |
| 88 | if (EnumHasAnyFlags(_flags, DistanceJointFlag::MaxDistance)) |
| 89 | { |
| 90 | max = Math::Min(_maxDistance, len - min); |
| 91 | end -= dir * max; |
| 92 | DEBUG_DRAW_LINE(end, target, Color::Red * 0.6f, 0, false); |
| 93 | } |
| 94 | DEBUG_DRAW_LINE(start, end, Color::Green * 0.6f, 0, false); |
| 95 | |
| 96 | // Base |
| 97 | Joint::OnDebugDrawSelected(); |
| 98 | } |
| 99 | |
| 100 | #endif |
| 101 |
nothing calls this directly
no test coverage detected