| 55 | #include "Engine/Core/Math/Color.h" |
| 56 | |
| 57 | void HingeJoint::OnDebugDrawSelected() |
| 58 | { |
| 59 | const Vector3 source = GetPosition(); |
| 60 | const Vector3 target = GetTargetPosition(); |
| 61 | const Quaternion xRotation = Quaternion::LookRotation(Vector3::UnitX, Vector3::UnitY); |
| 62 | const Quaternion sourceRotation = GetOrientation() * xRotation; |
| 63 | const Quaternion targetRotation = GetTargetOrientation() * xRotation; |
| 64 | const float size = 15.0f; |
| 65 | const Color color = Color::Green.AlphaMultiplied(0.6f); |
| 66 | const float arrowSize = size / 100.0f * 0.5f; |
| 67 | DEBUG_DRAW_WIRE_ARROW(source, sourceRotation, arrowSize, arrowSize * 0.5f, Color::Red, 0, false); |
| 68 | DEBUG_DRAW_WIRE_ARROW(target, targetRotation, arrowSize, arrowSize * 0.5f, Color::Blue, 0, false); |
| 69 | if (EnumHasAnyFlags(_flags, HingeJointFlag::Limit)) |
| 70 | { |
| 71 | const float upper = Math::Max(_limit.Upper, _limit.Lower); |
| 72 | const float range = Math::Abs(upper - _limit.Lower); |
| 73 | DEBUG_DRAW_ARC(source, sourceRotation * Quaternion::Euler(0, 0, _limit.Lower - 90.0f), size, range * DegreesToRadians, color, 0, false); |
| 74 | DEBUG_DRAW_WIRE_ARC(source, sourceRotation * Quaternion::Euler(0, 0, upper - 90.0f), size, (360.0f - range) * DegreesToRadians, Color::Red.AlphaMultiplied(0.6f), 0, false); |
| 75 | } |
| 76 | else |
| 77 | { |
| 78 | DEBUG_DRAW_ARC(source, sourceRotation, size, TWO_PI, color, 0, false); |
| 79 | } |
| 80 | DEBUG_DRAW_LINE(source, target, Color::Green * 0.6f, 0, false); |
| 81 | |
| 82 | // Base |
| 83 | Joint::OnDebugDrawSelected(); |
| 84 | } |
| 85 | |
| 86 | #endif |
| 87 |
nothing calls this directly
no test coverage detected