Add Physics Colliders debug view mode to display physical world shapes (solid)
This commit is contained in:
@@ -63,13 +63,23 @@ bool MeshCollider::CanBeTrigger() const
|
||||
#if USE_EDITOR
|
||||
|
||||
#include "Engine/Debug/DebugDraw.h"
|
||||
#include "Engine/Graphics/RenderView.h"
|
||||
|
||||
void MeshCollider::DrawPhysicsDebug(RenderView& view)
|
||||
{
|
||||
if (CollisionData && CollisionData->IsLoaded())
|
||||
{
|
||||
const auto& debugLines = CollisionData->GetDebugLines();
|
||||
DEBUG_DRAW_LINES(Span<Vector3>(debugLines.Get(), debugLines.Count()), _transform.GetWorld(), Color::GreenYellow * 0.8f, 0, true);
|
||||
if (view.Mode == ViewMode::PhysicsColliders && !GetIsTrigger())
|
||||
{
|
||||
Array<Vector3>* vertexBuffer;
|
||||
Array<int32>* indexBuffer;
|
||||
CollisionData->GetDebugTriangles(vertexBuffer, indexBuffer);
|
||||
DebugDraw::DrawTriangles(*vertexBuffer, *indexBuffer, _transform.GetWorld(), _staticActor ? Color::CornflowerBlue : Color::Orchid, 0, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugDraw::DrawLines(CollisionData->GetDebugLines(), _transform.GetWorld(), Color::GreenYellow * 0.8f, 0, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user