Add improvements for joints editing with debug shapes

This commit is contained in:
Wojtek Figat
2021-09-29 10:02:38 +02:00
parent 5c60281814
commit 3d1213d669
14 changed files with 252 additions and 13 deletions

View File

@@ -56,6 +56,30 @@ float SliderJoint::GetCurrentVelocity() const
return _joint ? static_cast<PxPrismaticJoint*>(_joint)->getVelocity() : 0.0f;
}
#if USE_EDITOR
#include "Engine/Debug/DebugDraw.h"
void SliderJoint::OnDebugDrawSelected()
{
const Vector3 source = GetPosition();
const Vector3 normal = GetOrientation() * Vector3::Right;
float min = -100.0f, max = 100.0f;
if (_flags & SliderJointFlag::Limit)
{
min = _limit.Lower;
max = _limit.Upper;
if (max < min)
Swap(min, max);
}
DEBUG_DRAW_LINE(source + normal * min, source + normal * max, Color::Green * 0.6f, 0, false);
// Base
Joint::OnDebugDrawSelected();
}
#endif
void SliderJoint::Serialize(SerializeStream& stream, const void* otherObj)
{
// Base