MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / OnDebugDrawSelected

Method OnDebugDrawSelected

Source/Engine/Physics/Joints/DistanceJoint.cpp:73–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71#include "Engine/Debug/DebugDraw.h"
72
73void 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

Callers

nothing calls this directly

Calls 5

EnumHasAnyFlagsFunction · 0.85
OnDebugDrawSelectedFunction · 0.85
GetPositionFunction · 0.50
MinFunction · 0.50
LengthMethod · 0.45

Tested by

no test coverage detected