mirror of
https://github.com/Ed94/Cog.git
synced 2026-08-05 15:18:47 +00:00
CogEngine: Improve collision tester and viewer
Replace usage of engine asset by debug config for the colors of collision channels
This commit is contained in:
@@ -38,16 +38,11 @@ void ACogEngineCollisionTester::Tick(float DeltaSeconds)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void ACogEngineCollisionTester::Query()
|
||||
void ACogEngineCollisionTester::Query() const
|
||||
{
|
||||
AlreadyDrawnActors.Empty();
|
||||
AlreadyDrawnComponents.Empty();
|
||||
|
||||
FVector QueryStart = StartComponent->GetComponentLocation();
|
||||
FVector QueryEnd = EndComponent->GetComponentLocation();
|
||||
FQuat QueryRotation = StartComponent->GetComponentQuat();
|
||||
TArray<FHitResult> Hits;
|
||||
TArray<FOverlapResult> Overlaps;
|
||||
bool HasHits = false;
|
||||
|
||||
static const FName TraceTag(TEXT("FCogWindow_Collision"));
|
||||
@@ -57,9 +52,7 @@ void ACogEngineCollisionTester::Query()
|
||||
const FName ProfileName = Profile != nullptr ? Profile->Name : FName();
|
||||
|
||||
FCollisionShape QueryShape;
|
||||
|
||||
const bool bIsUsingShape = Type == ECogEngine_CollisionQueryType::Overlap || Type == ECogEngine_CollisionQueryType::Sweep;
|
||||
if (bIsUsingShape)
|
||||
if (Type == ECogEngine_CollisionQueryType::Overlap || Type == ECogEngine_CollisionQueryType::Sweep)
|
||||
{
|
||||
switch (Shape)
|
||||
{
|
||||
@@ -71,439 +64,235 @@ void ACogEngineCollisionTester::Query()
|
||||
|
||||
switch (Type)
|
||||
{
|
||||
case ECogEngine_CollisionQueryType::Overlap:
|
||||
{
|
||||
switch (By)
|
||||
{
|
||||
case ECogEngine_CollisionQueryBy::Channel:
|
||||
{
|
||||
HasHits = GetWorld()->OverlapMultiByChannel(Overlaps, QueryStart, QueryRotation, Channel, QueryShape, QueryParams);
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryType::Overlap:
|
||||
{
|
||||
TArray<FOverlapResult> Overlaps;
|
||||
switch (By)
|
||||
{
|
||||
case ECogEngine_CollisionQueryBy::Channel:
|
||||
{
|
||||
HasHits = GetWorld()->OverlapMultiByChannel(Overlaps, QueryStart, QueryRotation, Channel, QueryShape, QueryParams);
|
||||
break;
|
||||
}
|
||||
|
||||
case ECogEngine_CollisionQueryBy::ObjectType:
|
||||
{
|
||||
FCollisionObjectQueryParams QueryObjectParams;
|
||||
QueryObjectParams.ObjectTypesToQuery = ObjectTypesToQuery;
|
||||
HasHits = GetWorld()->OverlapMultiByObjectType(Overlaps, QueryStart, QueryRotation, QueryObjectParams, QueryShape, QueryParams);
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryBy::ObjectType:
|
||||
{
|
||||
FCollisionObjectQueryParams QueryObjectParams;
|
||||
QueryObjectParams.ObjectTypesToQuery = ObjectTypesToQuery;
|
||||
HasHits = GetWorld()->OverlapMultiByObjectType(Overlaps, QueryStart, QueryRotation, QueryObjectParams, QueryShape, QueryParams);
|
||||
break;
|
||||
}
|
||||
|
||||
case ECogEngine_CollisionQueryBy::Profile:
|
||||
{
|
||||
HasHits = GetWorld()->OverlapMultiByProfile(Overlaps, QueryStart, QueryRotation, ProfileName, QueryShape, QueryParams);
|
||||
break;
|
||||
}
|
||||
}
|
||||
case ECogEngine_CollisionQueryBy::Profile:
|
||||
{
|
||||
HasHits = GetWorld()->OverlapMultiByProfile(Overlaps, QueryStart, QueryRotation, ProfileName, QueryShape, QueryParams);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
FCogDebugDrawOverlapParams DrawParams;
|
||||
FCogDebug::GetDebugDrawOverlapSettings(DrawParams);
|
||||
FCogDebugDrawHelper::DrawOverlap(GetWorld(), QueryShape, QueryStart, QueryRotation, Overlaps, DrawParams);
|
||||
break;
|
||||
}
|
||||
|
||||
case ECogEngine_CollisionQueryType::LineTrace:
|
||||
{
|
||||
switch (By)
|
||||
{
|
||||
case ECogEngine_CollisionQueryBy::Channel:
|
||||
{
|
||||
switch (Mode)
|
||||
{
|
||||
case ECogEngine_CollisionQueryMode::Single:
|
||||
{
|
||||
FHitResult Hit;
|
||||
HasHits = GetWorld()->LineTraceSingleByChannel(Hit, QueryStart, QueryEnd, Channel, QueryParams);
|
||||
if (HasHits)
|
||||
{
|
||||
Hits.Add(Hit);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Multi:
|
||||
{
|
||||
HasHits = GetWorld()->LineTraceMultiByChannel(Hits, QueryStart, QueryEnd, Channel, QueryParams);
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Test:
|
||||
{
|
||||
HasHits = GetWorld()->LineTraceTestByChannel(QueryStart, QueryEnd, Channel, QueryParams);
|
||||
break;
|
||||
}
|
||||
}
|
||||
case ECogEngine_CollisionQueryType::LineTrace:
|
||||
{
|
||||
TArray<FHitResult> Hits;
|
||||
switch (By)
|
||||
{
|
||||
case ECogEngine_CollisionQueryBy::Channel:
|
||||
{
|
||||
switch (Mode)
|
||||
{
|
||||
case ECogEngine_CollisionQueryMode::Single:
|
||||
{
|
||||
FHitResult Hit;
|
||||
HasHits = GetWorld()->LineTraceSingleByChannel(Hit, QueryStart, QueryEnd, Channel, QueryParams);
|
||||
if (HasHits)
|
||||
{
|
||||
Hits.Add(Hit);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Multi:
|
||||
{
|
||||
HasHits = GetWorld()->LineTraceMultiByChannel(Hits, QueryStart, QueryEnd, Channel, QueryParams);
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Test:
|
||||
{
|
||||
HasHits = GetWorld()->LineTraceTestByChannel(QueryStart, QueryEnd, Channel, QueryParams);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ECogEngine_CollisionQueryBy::ObjectType:
|
||||
{
|
||||
FCollisionObjectQueryParams QueryObjectParams;
|
||||
QueryObjectParams.ObjectTypesToQuery = ObjectTypesToQuery;
|
||||
case ECogEngine_CollisionQueryBy::ObjectType:
|
||||
{
|
||||
FCollisionObjectQueryParams QueryObjectParams;
|
||||
QueryObjectParams.ObjectTypesToQuery = ObjectTypesToQuery;
|
||||
|
||||
switch (Mode)
|
||||
{
|
||||
case ECogEngine_CollisionQueryMode::Single:
|
||||
{
|
||||
FHitResult Hit;
|
||||
HasHits = GetWorld()->LineTraceSingleByObjectType(Hit, QueryStart, QueryEnd, QueryObjectParams, QueryParams);
|
||||
if (HasHits)
|
||||
{
|
||||
Hits.Add(Hit);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Multi:
|
||||
{
|
||||
HasHits = GetWorld()->LineTraceMultiByObjectType(Hits, QueryStart, QueryEnd, QueryObjectParams, QueryParams);
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Test:
|
||||
{
|
||||
HasHits = GetWorld()->LineTraceTestByObjectType(QueryStart, QueryEnd, QueryObjectParams, QueryParams);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
switch (Mode)
|
||||
{
|
||||
case ECogEngine_CollisionQueryMode::Single:
|
||||
{
|
||||
FHitResult Hit;
|
||||
HasHits = GetWorld()->LineTraceSingleByObjectType(Hit, QueryStart, QueryEnd, QueryObjectParams, QueryParams);
|
||||
if (HasHits)
|
||||
{
|
||||
Hits.Add(Hit);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Multi:
|
||||
{
|
||||
HasHits = GetWorld()->LineTraceMultiByObjectType(Hits, QueryStart, QueryEnd, QueryObjectParams, QueryParams);
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Test:
|
||||
{
|
||||
HasHits = GetWorld()->LineTraceTestByObjectType(QueryStart, QueryEnd, QueryObjectParams, QueryParams);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ECogEngine_CollisionQueryBy::Profile:
|
||||
{
|
||||
switch (Mode)
|
||||
{
|
||||
case ECogEngine_CollisionQueryMode::Single:
|
||||
{
|
||||
FHitResult Hit;
|
||||
HasHits = GetWorld()->LineTraceSingleByProfile(Hit, QueryStart, QueryEnd, ProfileName, QueryParams);
|
||||
if (HasHits)
|
||||
{
|
||||
Hits.Add(Hit);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Multi:
|
||||
{
|
||||
HasHits = GetWorld()->LineTraceMultiByProfile(Hits, QueryStart, QueryEnd, ProfileName, QueryParams);
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Test:
|
||||
{
|
||||
HasHits = GetWorld()->LineTraceTestByProfile(QueryStart, QueryEnd, ProfileName, QueryParams);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryBy::Profile:
|
||||
{
|
||||
switch (Mode)
|
||||
{
|
||||
case ECogEngine_CollisionQueryMode::Single:
|
||||
{
|
||||
FHitResult Hit;
|
||||
HasHits = GetWorld()->LineTraceSingleByProfile(Hit, QueryStart, QueryEnd, ProfileName, QueryParams);
|
||||
if (HasHits)
|
||||
{
|
||||
Hits.Add(Hit);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Multi:
|
||||
{
|
||||
HasHits = GetWorld()->LineTraceMultiByProfile(Hits, QueryStart, QueryEnd, ProfileName, QueryParams);
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Test:
|
||||
{
|
||||
HasHits = GetWorld()->LineTraceTestByProfile(QueryStart, QueryEnd, ProfileName, QueryParams);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
case ECogEngine_CollisionQueryType::Sweep:
|
||||
{
|
||||
switch (By)
|
||||
{
|
||||
case ECogEngine_CollisionQueryBy::Channel:
|
||||
{
|
||||
switch (Mode)
|
||||
{
|
||||
case ECogEngine_CollisionQueryMode::Single:
|
||||
{
|
||||
FHitResult Hit;
|
||||
HasHits = GetWorld()->SweepSingleByChannel(Hit, QueryStart, QueryEnd, QueryRotation, Channel, QueryShape, QueryParams);
|
||||
if (HasHits)
|
||||
{
|
||||
Hits.Add(Hit);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Multi:
|
||||
{
|
||||
HasHits = GetWorld()->SweepMultiByChannel(Hits, QueryStart, QueryEnd, QueryRotation, Channel, QueryShape, QueryParams);
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Test:
|
||||
{
|
||||
HasHits = GetWorld()->SweepTestByChannel(QueryStart, QueryEnd, QueryRotation, Channel, QueryShape, QueryParams);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
FCogDebugDrawLineTraceParams DrawParams;
|
||||
FCogDebug::GetDebugDrawLineTraceSettings(DrawParams);
|
||||
FCogDebugDrawHelper::DrawLineTrace(GetWorld(), QueryStart, QueryEnd, HasHits, Hits, DrawParams);
|
||||
break;
|
||||
}
|
||||
|
||||
case ECogEngine_CollisionQueryBy::ObjectType:
|
||||
{
|
||||
FCollisionObjectQueryParams QueryObjectParams;
|
||||
QueryObjectParams.ObjectTypesToQuery = ObjectTypesToQuery;
|
||||
case ECogEngine_CollisionQueryType::Sweep:
|
||||
{
|
||||
TArray<FHitResult> Hits;
|
||||
switch (By)
|
||||
{
|
||||
case ECogEngine_CollisionQueryBy::Channel:
|
||||
{
|
||||
switch (Mode)
|
||||
{
|
||||
case ECogEngine_CollisionQueryMode::Single:
|
||||
{
|
||||
FHitResult Hit;
|
||||
HasHits = GetWorld()->SweepSingleByChannel(Hit, QueryStart, QueryEnd, QueryRotation, Channel, QueryShape, QueryParams);
|
||||
if (HasHits)
|
||||
{
|
||||
Hits.Add(Hit);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Multi:
|
||||
{
|
||||
HasHits = GetWorld()->SweepMultiByChannel(Hits, QueryStart, QueryEnd, QueryRotation, Channel, QueryShape, QueryParams);
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Test:
|
||||
{
|
||||
HasHits = GetWorld()->SweepTestByChannel(QueryStart, QueryEnd, QueryRotation, Channel, QueryShape, QueryParams);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
switch (Mode)
|
||||
{
|
||||
case ECogEngine_CollisionQueryMode::Single:
|
||||
{
|
||||
FHitResult Hit;
|
||||
HasHits = GetWorld()->SweepSingleByObjectType(Hit, QueryStart, QueryEnd, QueryRotation, QueryObjectParams, QueryShape, QueryParams);
|
||||
if (HasHits)
|
||||
{
|
||||
Hits.Add(Hit);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Multi:
|
||||
{
|
||||
HasHits = GetWorld()->SweepMultiByObjectType(Hits, QueryStart, QueryEnd, QueryRotation, QueryObjectParams, QueryShape, QueryParams);
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Test:
|
||||
{
|
||||
HasHits = GetWorld()->SweepTestByObjectType(QueryStart, QueryEnd, QueryRotation, QueryObjectParams, QueryShape, QueryParams);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryBy::ObjectType:
|
||||
{
|
||||
FCollisionObjectQueryParams QueryObjectParams;
|
||||
QueryObjectParams.ObjectTypesToQuery = ObjectTypesToQuery;
|
||||
|
||||
case ECogEngine_CollisionQueryBy::Profile:
|
||||
{
|
||||
switch (Mode)
|
||||
{
|
||||
case ECogEngine_CollisionQueryMode::Single:
|
||||
{
|
||||
FHitResult Hit;
|
||||
HasHits = GetWorld()->SweepSingleByProfile(Hit, QueryStart, QueryEnd, QueryRotation, ProfileName, QueryShape, QueryParams);
|
||||
if (HasHits)
|
||||
{
|
||||
Hits.Add(Hit);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Multi:
|
||||
{
|
||||
HasHits = GetWorld()->SweepMultiByProfile(Hits, QueryStart, QueryEnd, QueryRotation, ProfileName, QueryShape, QueryParams);
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Test:
|
||||
{
|
||||
HasHits = GetWorld()->SweepTestByProfile(QueryStart, QueryEnd, QueryRotation, ProfileName, QueryShape, QueryParams);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (Mode)
|
||||
{
|
||||
case ECogEngine_CollisionQueryMode::Single:
|
||||
{
|
||||
FHitResult Hit;
|
||||
HasHits = GetWorld()->SweepSingleByObjectType(Hit, QueryStart, QueryEnd, QueryRotation, QueryObjectParams, QueryShape, QueryParams);
|
||||
if (HasHits)
|
||||
{
|
||||
Hits.Add(Hit);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Multi:
|
||||
{
|
||||
HasHits = GetWorld()->SweepMultiByObjectType(Hits, QueryStart, QueryEnd, QueryRotation, QueryObjectParams, QueryShape, QueryParams);
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Test:
|
||||
{
|
||||
HasHits = GetWorld()->SweepTestByObjectType(QueryStart, QueryEnd, QueryRotation, QueryObjectParams, QueryShape, QueryParams);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
const FColor Color = HasHits ? FLinearColor(HitColor).ToFColor(true) : FLinearColor(NoHitColor).ToFColor(true);
|
||||
const bool bUseTrace = Type == ECogEngine_CollisionQueryType::LineTrace || Type == ECogEngine_CollisionQueryType::Sweep;
|
||||
if (bUseTrace)
|
||||
{
|
||||
DrawDebugDirectionalArrow(
|
||||
GetWorld(),
|
||||
QueryStart,
|
||||
QueryEnd,
|
||||
FCogDebug::Settings.ArrowSize,
|
||||
Color,
|
||||
false,
|
||||
0.0f,
|
||||
FCogDebug::GetDebugDepthPriority(0),
|
||||
FCogDebug::GetDebugThickness(0.0f));
|
||||
}
|
||||
case ECogEngine_CollisionQueryBy::Profile:
|
||||
{
|
||||
switch (Mode)
|
||||
{
|
||||
case ECogEngine_CollisionQueryMode::Single:
|
||||
{
|
||||
FHitResult Hit;
|
||||
HasHits = GetWorld()->SweepSingleByProfile(Hit, QueryStart, QueryEnd, QueryRotation, ProfileName, QueryShape, QueryParams);
|
||||
if (HasHits)
|
||||
{
|
||||
Hits.Add(Hit);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Multi:
|
||||
{
|
||||
HasHits = GetWorld()->SweepMultiByProfile(Hits, QueryStart, QueryEnd, QueryRotation, ProfileName, QueryShape, QueryParams);
|
||||
break;
|
||||
}
|
||||
case ECogEngine_CollisionQueryMode::Test:
|
||||
{
|
||||
HasHits = GetWorld()->SweepTestByProfile(QueryStart, QueryEnd, QueryRotation, ProfileName, QueryShape, QueryParams);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bIsUsingShape)
|
||||
{
|
||||
DrawShape(QueryShape, QueryStart, QueryRotation, FVector::OneVector, Color, false);
|
||||
}
|
||||
|
||||
for (const FOverlapResult& Overlap : Overlaps)
|
||||
{
|
||||
if (DrawHitPrimitives)
|
||||
{
|
||||
DrawPrimitive(Overlap.GetComponent());
|
||||
}
|
||||
}
|
||||
|
||||
for (const FHitResult& Hit : Hits)
|
||||
{
|
||||
if (DrawHitLocations)
|
||||
{
|
||||
DrawDebugPoint(
|
||||
GetWorld(),
|
||||
Hit.Location,
|
||||
HitPointSize,
|
||||
Color,
|
||||
false,
|
||||
0.0f,
|
||||
FCogDebug::GetDebugDepthPriority(0));
|
||||
}
|
||||
|
||||
if (DrawHitImpactPoints)
|
||||
{
|
||||
DrawDebugPoint(
|
||||
GetWorld(),
|
||||
Hit.ImpactPoint,
|
||||
HitPointSize,
|
||||
Color,
|
||||
false,
|
||||
0.0f,
|
||||
FCogDebug::GetDebugDepthPriority(0));
|
||||
}
|
||||
|
||||
if (bIsUsingShape && DrawHitShapes)
|
||||
{
|
||||
DrawShape(QueryShape, Hit.Location, QueryRotation, FVector::OneVector, Color, false);
|
||||
}
|
||||
|
||||
if (DrawHitNormals)
|
||||
{
|
||||
DrawDebugDirectionalArrow(
|
||||
GetWorld(),
|
||||
Hit.Location,
|
||||
Hit.Location + Hit.Normal * 20.0f,
|
||||
FCogDebug::Settings.ArrowSize,
|
||||
FLinearColor(NormalColor).ToFColor(true),
|
||||
false,
|
||||
0.0f,
|
||||
FCogDebug::GetDebugDepthPriority(0),
|
||||
FCogDebug::GetDebugThickness(0.0f));
|
||||
}
|
||||
|
||||
if (DrawHitImpactNormals)
|
||||
{
|
||||
DrawDebugDirectionalArrow(
|
||||
GetWorld(),
|
||||
Hit.ImpactPoint,
|
||||
Hit.ImpactPoint + Hit.ImpactNormal * 20.0f,
|
||||
FCogDebug::Settings.ArrowSize,
|
||||
FLinearColor(ImpactNormalColor).ToFColor(true),
|
||||
false,
|
||||
0.0f,
|
||||
FCogDebug::GetDebugDepthPriority(0),
|
||||
FCogDebug::GetDebugThickness(0.0f));
|
||||
}
|
||||
|
||||
if (DrawHitPrimitives)
|
||||
{
|
||||
DrawPrimitive(Hit.GetComponent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void ACogEngineCollisionTester::DrawPrimitive(const UPrimitiveComponent* PrimitiveComponent)
|
||||
{
|
||||
//-------------------------------------------------------
|
||||
// Don't draw same primitives multiple times (for bones)
|
||||
//-------------------------------------------------------
|
||||
if (AlreadyDrawnComponents.Contains(PrimitiveComponent))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AlreadyDrawnComponents.Add(PrimitiveComponent);
|
||||
|
||||
ECollisionChannel CollisionObjectType = PrimitiveComponent->GetCollisionObjectType();
|
||||
FColor Color = FColor::Green; // Channels[CollisionObjectType].Color;
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Draw Name
|
||||
//-------------------------------------------------------
|
||||
if (DrawHitActorsNames)
|
||||
{
|
||||
const AActor* Actor = PrimitiveComponent->GetOwner();
|
||||
if (Actor != nullptr)
|
||||
{
|
||||
if (AlreadyDrawnActors.Contains(Actor) == false)
|
||||
{
|
||||
FColor TextColor = Color.WithAlpha(255);
|
||||
DrawDebugString(GetWorld(), Actor->GetActorLocation(), GetNameSafe(Actor->GetClass()), nullptr, FColor::White, 0.0f, FCogDebug::Settings.TextShadow, FCogDebug::Settings.TextSize);
|
||||
AlreadyDrawnActors.Add(Actor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const FVector Location = PrimitiveComponent->GetComponentLocation();
|
||||
const FQuat Rotation = PrimitiveComponent->GetComponentQuat();
|
||||
const FVector Scale = PrimitiveComponent->GetComponentScale();
|
||||
const FCollisionShape PrimitiveShape = PrimitiveComponent->GetCollisionShape();
|
||||
DrawShape(PrimitiveShape, Location, Rotation, Scale, Color, true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void ACogEngineCollisionTester::DrawShape(const FCollisionShape& InShape, const FVector& InLocation, const FQuat& InRotation, const FVector& InScale, const FColor& InColor, bool InDrawSolid) const
|
||||
{
|
||||
switch (InShape.ShapeType)
|
||||
{
|
||||
case ECollisionShape::Box:
|
||||
{
|
||||
//--------------------------------------------------
|
||||
// see UBoxComponent::GetScaledBoxExtent()
|
||||
//--------------------------------------------------
|
||||
const FVector HalfExtent(InShape.Box.HalfExtentX * InScale.X, InShape.Box.HalfExtentY * InScale.Y, InShape.Box.HalfExtentZ * InScale.Z);
|
||||
|
||||
if (InDrawSolid)
|
||||
{
|
||||
DrawDebugSolidBox(
|
||||
GetWorld(),
|
||||
InLocation,
|
||||
HalfExtent,
|
||||
InRotation,
|
||||
InColor,
|
||||
false,
|
||||
0.0f,
|
||||
FCogDebug::GetDebugDepthPriority(0));
|
||||
}
|
||||
|
||||
DrawDebugBox(
|
||||
GetWorld(),
|
||||
InLocation,
|
||||
HalfExtent,
|
||||
InRotation,
|
||||
InColor,
|
||||
false,
|
||||
0.0f,
|
||||
FCogDebug::GetDebugDepthPriority(0),
|
||||
FCogDebug::GetDebugThickness(0.0f));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case ECollisionShape::Sphere:
|
||||
{
|
||||
//--------------------------------------------------
|
||||
// see USphereComponent::GetScaledSphereRadius()
|
||||
//--------------------------------------------------
|
||||
const float RadiusScale = FMath::Min(InScale.X, FMath::Min(InScale.Y, InScale.Z));
|
||||
const float Radius = InShape.Sphere.Radius * RadiusScale;
|
||||
|
||||
FCogDebugDrawHelper::DrawSphere(
|
||||
GetWorld(),
|
||||
InLocation,
|
||||
Radius,
|
||||
FCogDebug::GetCircleSegments(),
|
||||
InColor,
|
||||
false,
|
||||
0.0f,
|
||||
FCogDebug::GetDebugDepthPriority(0),
|
||||
FCogDebug::GetDebugThickness(0.0f));
|
||||
break;
|
||||
}
|
||||
|
||||
case ECollisionShape::Capsule:
|
||||
{
|
||||
//--------------------------------------------------
|
||||
// see UCapsuleComponent::GetScaledCapsuleRadius()
|
||||
//--------------------------------------------------
|
||||
const float Radius = InShape.Capsule.Radius * FMath::Min(InScale.X, InScale.Y);
|
||||
const float HalfHeight = InShape.Capsule.HalfHeight * UE_REAL_TO_FLOAT(InScale.Z);
|
||||
|
||||
DrawDebugCapsule(
|
||||
GetWorld(),
|
||||
InLocation,
|
||||
HalfHeight,
|
||||
Radius,
|
||||
InRotation,
|
||||
InColor,
|
||||
false,
|
||||
0.0f,
|
||||
FCogDebug::GetDebugDepthPriority(0),
|
||||
FCogDebug::GetDebugThickness(0.0f));
|
||||
break;
|
||||
}
|
||||
FCogDebugDrawSweepParams DrawParams;
|
||||
FCogDebug::GetDebugDrawSweepSettings(DrawParams);
|
||||
FCogDebugDrawHelper::DrawSweep(GetWorld(), QueryShape, QueryStart, QueryEnd, QueryRotation, HasHits, Hits, DrawParams);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "CogEngineWindow_CollisionTester.h"
|
||||
|
||||
#include "CogDebug.h"
|
||||
#include "CogEngineDataAsset.h"
|
||||
#include "CogImGuiHelper.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "Components/PrimitiveComponent.h"
|
||||
@@ -15,8 +14,6 @@ void FCogEngineWindow_CollisionTester::Initialize()
|
||||
|
||||
bHasMenu = true;
|
||||
|
||||
SetAsset(GetAsset<UCogEngineDataAsset>());
|
||||
|
||||
Config = GetConfig<UCogEngineConfig_CollisionTester>();
|
||||
}
|
||||
|
||||
@@ -34,117 +31,80 @@ void FCogEngineWindow_CollisionTester::ResetConfig()
|
||||
Config->Reset();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool RenderCollisionProfileChannels(const UCollisionProfile& CollisionProfileChannels, int32& Channels, const TArray<FCogCollisionChannel>& ChannelsConfig)
|
||||
{
|
||||
bool Result = false;
|
||||
|
||||
for (const FCogCollisionChannel& ChannelConfig : ChannelsConfig)
|
||||
{
|
||||
const ECollisionChannel Channel = ChannelConfig.Channel.GetValue();
|
||||
ImGui::PushID(Channel);
|
||||
|
||||
ImColor Color = FCogImguiHelper::ToImColor(ChannelConfig.Color);
|
||||
ImGui::ColorEdit4("Color", (float*)&Color.Value, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel);
|
||||
ImGui::SameLine();
|
||||
|
||||
bool IsCollisionActive = (Channels & ECC_TO_BITFIELD(Channel)) > 0;
|
||||
const FName ChannelName = CollisionProfileChannels.ReturnChannelNameFromContainerIndex(Channel);
|
||||
if (ImGui::Checkbox(TCHAR_TO_ANSI(*ChannelName.ToString()), &IsCollisionActive))
|
||||
{
|
||||
Result = true;
|
||||
|
||||
if (IsCollisionActive)
|
||||
{
|
||||
Channels |= ECC_TO_BITFIELD(Channel);
|
||||
}
|
||||
else
|
||||
{
|
||||
Channels &= ~ECC_TO_BITFIELD(Channel);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
bool RenderComboCollisionChannel(const char* Label, const UCollisionProfile& CollisionProfile, ECollisionChannel& SelectedChannel, const TArray<FCogCollisionChannel>& ChannelsConfig)
|
||||
{
|
||||
const FName SelectedChannelName = CollisionProfile.ReturnChannelNameFromContainerIndex(SelectedChannel);
|
||||
|
||||
bool Result = false;
|
||||
if (ImGui::BeginCombo(Label, TCHAR_TO_ANSI(*SelectedChannelName.ToString()), ImGuiComboFlags_HeightLarge))
|
||||
{
|
||||
for (const FCogCollisionChannel& ChannelConfig : ChannelsConfig)
|
||||
{
|
||||
const ECollisionChannel Channel = ChannelConfig.Channel.GetValue();
|
||||
ImGui::PushID(Channel);
|
||||
|
||||
const FName ChannelName = CollisionProfile.ReturnChannelNameFromContainerIndex(Channel);
|
||||
|
||||
ImColor Color = FCogImguiHelper::ToImColor(ChannelConfig.Color);
|
||||
ImGui::ColorEdit4("Color", (float*)&Color.Value, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel);
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Selectable(TCHAR_TO_ANSI(*ChannelName.ToString())))
|
||||
{
|
||||
SelectedChannel = Channel;
|
||||
Result = true;
|
||||
}
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_CollisionTester::RenderContent()
|
||||
{
|
||||
Super::RenderContent();
|
||||
|
||||
ACogEngineCollisionTester* CollisionTester = Cast<ACogEngineCollisionTester>(GetSelection());
|
||||
|
||||
//-------------------------------------------------
|
||||
// Menu
|
||||
//-------------------------------------------------
|
||||
if (ImGui::BeginMenuBar())
|
||||
{
|
||||
if (ImGui::BeginMenu("Options"))
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, IM_COL32(0, 0, 0, 0));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 0.0f));
|
||||
|
||||
if (ImGui::ArrowButton("SelectPrev", ImGuiDir_Left))
|
||||
{
|
||||
ImGui::Checkbox("Draw Hit Locations", &Config->DrawHitLocations);
|
||||
ImGui::Checkbox("Draw Hit Impact Points", &Config->DrawHitImpactPoints);
|
||||
ImGui::Checkbox("Draw Hit Shapes", &Config->DrawHitShapes);
|
||||
ImGui::Checkbox("Draw Hit Normal", &Config->DrawHitNormals);
|
||||
ImGui::Checkbox("Draw Hit Impact Normal", &Config->DrawHitImpactNormals);
|
||||
ImGui::Checkbox("Draw Hit Primitives", &Config->DrawHitPrimitives);
|
||||
ImGui::Checkbox("Draw Hit Actors Names", &Config->DrawHitActorsNames);
|
||||
}
|
||||
if (ImGui::BeginItemTooltip())
|
||||
{
|
||||
ImGui::SetTooltip("Select previous collision tester");
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::SliderFloat("Hit Point Size", &Config->HitPointSize, 0.0f, 20.0f, "%0.f");
|
||||
ImGui::SameLine();
|
||||
if (ImGui::ArrowButton("SelectNext", ImGuiDir_Right))
|
||||
{
|
||||
}
|
||||
if (ImGui::BeginItemTooltip())
|
||||
{
|
||||
ImGui::SetTooltip("Select next collision tester");
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
ImGui::ColorEdit4("No Hit Color", (float*)&Config->NoHitColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Hit Color", (float*)&Config->HitColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Normal Color", (float*)&Config->NormalColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::ColorEdit4("Impact Normal Color", (float*)&Config->ImpactNormalColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::PopStyleColor(1);
|
||||
ImGui::PopStyleVar(1);
|
||||
|
||||
ImGui::EndMenu();
|
||||
|
||||
if (ImGui::MenuItem("Spawn"))
|
||||
{
|
||||
const FActorSpawnParameters SpawnInfo;
|
||||
const FTransform Transform = GetSelection() ? GetSelection()->GetActorTransform() : FTransform::Identity;
|
||||
ACogEngineCollisionTester* Actor = GetWorld()->SpawnActor<ACogEngineCollisionTester>(ACogEngineCollisionTester::StaticClass(), Transform, SpawnInfo);
|
||||
FCogDebug::SetSelection(GetWorld(), Actor);
|
||||
}
|
||||
if (ImGui::BeginItemTooltip())
|
||||
{
|
||||
ImGui::SetTooltip("Spawn a new collision tester");
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
const bool Disable = CollisionTester == nullptr;
|
||||
if (Disable)
|
||||
{
|
||||
ImGui::BeginDisabled();
|
||||
}
|
||||
if (ImGui::MenuItem("Delete"))
|
||||
{
|
||||
GetWorld()->DestroyActor(CollisionTester);
|
||||
CollisionTester = nullptr;
|
||||
}
|
||||
if (ImGui::BeginItemTooltip())
|
||||
{
|
||||
ImGui::SetTooltip("Delete selected collision tester");
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
if (Disable)
|
||||
{
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
|
||||
if (ImGui::Button("Spawn Collision Tester", ImVec2(-1, 0)))
|
||||
{
|
||||
const FActorSpawnParameters SpawnInfo;
|
||||
ACogEngineCollisionTester* Actor = GetWorld()->SpawnActor<ACogEngineCollisionTester>(SpawnInfo);
|
||||
FCogDebug::SetSelection(GetWorld(), Actor);
|
||||
}
|
||||
|
||||
ACogEngineCollisionTester* CollisionTester = Cast<ACogEngineCollisionTester>(GetSelection());
|
||||
if (CollisionTester == nullptr)
|
||||
{
|
||||
ImGui::TextDisabled("Spawn or select a Collision Tester actor");
|
||||
@@ -183,7 +143,7 @@ void FCogEngineWindow_CollisionTester::RenderContent()
|
||||
{
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ECollisionChannel Channel = CollisionTester->Channel.GetValue();
|
||||
if (RenderComboCollisionChannel("Channel", *CollisionProfile, Channel, Asset->Channels))
|
||||
if (FCogWindowWidgets::ComboCollisionChannel("Channel", Channel))
|
||||
{
|
||||
CollisionTester->Channel = Channel;
|
||||
}
|
||||
@@ -241,24 +201,24 @@ void FCogEngineWindow_CollisionTester::RenderContent()
|
||||
case ECogEngine_CollisionQueryShape::Sphere:
|
||||
{
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
FCogImguiHelper::DragDouble("Sphere Radius", &CollisionTester->ShapeExtent.X, 0.1f, 0, FLT_MAX, "%.1f");
|
||||
FCogImguiHelper::DragDouble("Sphere Radius", &CollisionTester->ShapeExtent.X, 1.0f, 0, FLT_MAX, "%.1f");
|
||||
break;
|
||||
}
|
||||
|
||||
case ECogEngine_CollisionQueryShape::Box:
|
||||
{
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
FCogImguiHelper::DragFVector("Box Extent", CollisionTester->ShapeExtent, 0.1f, 0, FLT_MAX, "%.1f");
|
||||
FCogImguiHelper::DragFVector("Box Extent", CollisionTester->ShapeExtent, 1.0f, 0, FLT_MAX, "%.1f");
|
||||
break;
|
||||
}
|
||||
|
||||
case ECogEngine_CollisionQueryShape::Capsule:
|
||||
{
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
FCogImguiHelper::DragDouble("Capsule Radius", &CollisionTester->ShapeExtent.X, 0.1f, 0, FLT_MAX, "%.1f");
|
||||
FCogImguiHelper::DragDouble("Capsule Radius", &CollisionTester->ShapeExtent.X, 1.0f, 0, FLT_MAX, "%.1f");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
FCogImguiHelper::DragDouble("Capsule Half Height", &CollisionTester->ShapeExtent.Z, 0.1f, 0, FLT_MAX, "%.1f");
|
||||
FCogImguiHelper::DragDouble("Capsule Half Height", &CollisionTester->ShapeExtent.Z, 1.0f, 0, FLT_MAX, "%.1f");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -272,34 +232,11 @@ void FCogEngineWindow_CollisionTester::RenderContent()
|
||||
if (CollisionTester->By == ECogEngine_CollisionQueryBy::Profile)
|
||||
{
|
||||
ImGui::BeginDisabled();
|
||||
RenderCollisionProfileChannels(*CollisionProfile, CollisionTester->ObjectTypesToQuery, Asset->Channels);
|
||||
FCogWindowWidgets::CollisionProfileChannels(CollisionTester->ObjectTypesToQuery);
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
else if (CollisionTester->By == ECogEngine_CollisionQueryBy::ObjectType)
|
||||
{
|
||||
RenderCollisionProfileChannels(*CollisionProfile, CollisionTester->ObjectTypesToQuery, Asset->Channels);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_CollisionTester::SetAsset(const UCogEngineDataAsset* Value)
|
||||
{
|
||||
Asset = Value;
|
||||
|
||||
if (Asset == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (FChannel& Channel : Channels)
|
||||
{
|
||||
Channel.IsValid = false;
|
||||
}
|
||||
|
||||
for (const FCogCollisionChannel& AssetChannel : Asset->Channels)
|
||||
{
|
||||
FChannel& Channel = Channels[(uint8)AssetChannel.Channel];
|
||||
Channel.IsValid = true;
|
||||
Channel.Color = AssetChannel.Color.ToFColor(true);
|
||||
FCogWindowWidgets::CollisionProfileChannels(CollisionTester->ObjectTypesToQuery);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,11 @@
|
||||
|
||||
#include "CogDebugDrawHelper.h"
|
||||
#include "CogDebug.h"
|
||||
#include "CogEngineDataAsset.h"
|
||||
#include "CogEngineCollisionTester.h"
|
||||
#include "CogImguiHelper.h"
|
||||
#include "CogWindowHelper.h"
|
||||
#include "Components/BoxComponent.h"
|
||||
#include "Components/CapsuleComponent.h"
|
||||
#include "CogWindowWidgets.h"
|
||||
#include "Components/PrimitiveComponent.h"
|
||||
#include "Components/SceneComponent.h"
|
||||
#include "Components/SphereComponent.h"
|
||||
#include "DrawDebugHelpers.h"
|
||||
#include "Engine/World.h"
|
||||
#include "GameFramework/Pawn.h"
|
||||
@@ -24,8 +21,6 @@ void FCogEngineWindow_CollisionViewer::Initialize()
|
||||
|
||||
bHasMenu = true;
|
||||
|
||||
SetAsset(GetAsset<UCogEngineDataAsset>());
|
||||
|
||||
Config = GetConfig<UCogEngineConfig_CollisionViewer>();
|
||||
}
|
||||
|
||||
@@ -34,8 +29,6 @@ void FCogEngineWindow_CollisionViewer::RenderHelp()
|
||||
{
|
||||
ImGui::Text("This window is used to inspect collisions by performing a collision query with the selected channels. "
|
||||
"The query can be configured in the options. "
|
||||
"The displayed collision channels can be configured in the '%s' data asset. "
|
||||
, TCHAR_TO_ANSI(*GetNameSafe(Asset.Get()))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -108,11 +101,6 @@ void FCogEngineWindow_CollisionViewer::RenderContent()
|
||||
//-------------------------------------------------
|
||||
ImGui::Checkbox("Show Actors Names", &Config->ShowActorsNames);
|
||||
|
||||
//-------------------------------------------------
|
||||
// Show Query
|
||||
//-------------------------------------------------
|
||||
ImGui::Checkbox("Show Query", &Config->ShowQuery);
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
@@ -153,41 +141,7 @@ void FCogEngineWindow_CollisionViewer::RenderContent()
|
||||
}
|
||||
ImGui::Separator();
|
||||
|
||||
//-------------------------------------------------
|
||||
// Query Filtering
|
||||
//-------------------------------------------------
|
||||
for (int ChannelIndex = 0; ChannelIndex < (int32)ECC_MAX; ++ChannelIndex)
|
||||
{
|
||||
const FChannel& Channel = Channels[ChannelIndex];
|
||||
if (Channel.IsValid == false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ImGui::PushID(ChannelIndex);
|
||||
|
||||
ImColor Color = FCogImguiHelper::ToImColor(Channel.Color);
|
||||
ImGui::ColorEdit4("Color", (float*)&Color.Value, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel);
|
||||
ImGui::SameLine();
|
||||
|
||||
bool IsCollisionActive = (Config->ObjectTypesToQuery & ECC_TO_BITFIELD(ChannelIndex)) > 0;
|
||||
const FName ChannelName = CollisionProfile->ReturnChannelNameFromContainerIndex(ChannelIndex);
|
||||
if (ImGui::Checkbox(TCHAR_TO_ANSI(*ChannelName.ToString()), &IsCollisionActive))
|
||||
{
|
||||
if (IsCollisionActive)
|
||||
{
|
||||
Config->ObjectTypesToQuery |= ECC_TO_BITFIELD(ChannelIndex);
|
||||
Config->ProfileIndex = INDEX_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
Config->ObjectTypesToQuery &= ~ECC_TO_BITFIELD(ChannelIndex);
|
||||
Config->ProfileIndex = INDEX_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
FCogWindowWidgets::CollisionProfileChannels(Config->ObjectTypesToQuery);
|
||||
|
||||
//-------------------------------------------------
|
||||
// Perform Query
|
||||
@@ -247,10 +201,10 @@ void FCogEngineWindow_CollisionViewer::RenderContent()
|
||||
FCollisionShape QueryShape;
|
||||
QueryShape.SetSphere(QueryRadius);
|
||||
|
||||
TArray<FHitResult> QueryHits;
|
||||
TArray<FHitResult> HitResults;
|
||||
UWorld* World = GetWorld();
|
||||
World->SweepMultiByObjectType(
|
||||
QueryHits,
|
||||
HitResults,
|
||||
QueryStart,
|
||||
QueryEnd,
|
||||
FQuat::Identity,
|
||||
@@ -258,153 +212,13 @@ void FCogEngineWindow_CollisionViewer::RenderContent()
|
||||
QueryShape,
|
||||
QueryParams);
|
||||
|
||||
if (Config->ShowQuery)
|
||||
{
|
||||
FCogDebugDrawHelper::DrawCapsuleCastMulti(World, QueryStart, QueryEnd, FQuat::Identity, 0.0f, QueryRadius, EDrawDebugTrace::ForOneFrame, false, QueryHits, FLinearColor::White, FLinearColor::Red, FCogDebug::GetDebugDuration(true));
|
||||
}
|
||||
|
||||
TSet<const AActor*> AlreadyDrawnActors;
|
||||
TSet<const UPrimitiveComponent*> AlreadyDrawnComponents;
|
||||
|
||||
for (const FHitResult& HitResult : QueryHits)
|
||||
{
|
||||
//-------------------------------------------------------
|
||||
// Don't draw same primitives multiple times (for bones)
|
||||
//-------------------------------------------------------
|
||||
const UPrimitiveComponent* PrimitiveComponent = HitResult.GetComponent();
|
||||
if (AlreadyDrawnComponents.Contains(PrimitiveComponent))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
AlreadyDrawnComponents.Add(PrimitiveComponent);
|
||||
|
||||
ECollisionChannel CollisionObjectType = PrimitiveComponent->GetCollisionObjectType();
|
||||
FColor Color = Channels[CollisionObjectType].Color;
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Draw Name
|
||||
//-------------------------------------------------------
|
||||
if (Config->ShowActorsNames)
|
||||
{
|
||||
const AActor* Actor = HitResult.GetActor();
|
||||
if (Actor != nullptr)
|
||||
{
|
||||
if (AlreadyDrawnActors.Contains(Actor) == false)
|
||||
{
|
||||
FColor TextColor = Color.WithAlpha(255);
|
||||
DrawDebugString(World, Actor->GetActorLocation(), GetNameSafe(Actor->GetClass()), nullptr, FColor::White, 0.0f, FCogDebug::Settings.TextShadow, FCogDebug::Settings.TextSize);
|
||||
AlreadyDrawnActors.Add(Actor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Draw Shape
|
||||
//-------------------------------------------------------
|
||||
FCollisionShape Shape = PrimitiveComponent->GetCollisionShape();
|
||||
switch (Shape.ShapeType)
|
||||
{
|
||||
case ECollisionShape::Box:
|
||||
{
|
||||
FVector Location;
|
||||
FVector Extent;
|
||||
FQuat Rotation;
|
||||
|
||||
if (const UBoxComponent* BoxComponent = Cast<UBoxComponent>(PrimitiveComponent))
|
||||
{
|
||||
Location = BoxComponent->GetComponentLocation();
|
||||
Extent = BoxComponent->GetScaledBoxExtent();
|
||||
Rotation = BoxComponent->GetComponentQuat();
|
||||
}
|
||||
else
|
||||
{
|
||||
PrimitiveComponent->Bounds.GetBox().GetCenterAndExtents(Location, Extent);
|
||||
Extent += FVector::OneVector;
|
||||
Rotation = FQuat::Identity;
|
||||
}
|
||||
|
||||
DrawDebugSolidBox(
|
||||
World,
|
||||
Location,
|
||||
Extent,
|
||||
Rotation,
|
||||
Color,
|
||||
false,
|
||||
0.0f,
|
||||
FCogDebug::GetDebugDepthPriority(0));
|
||||
|
||||
DrawDebugBox(
|
||||
World,
|
||||
Location,
|
||||
Extent,
|
||||
Rotation,
|
||||
Color,
|
||||
false,
|
||||
0.0f,
|
||||
FCogDebug::GetDebugDepthPriority(0),
|
||||
FCogDebug::GetDebugThickness(0.0f));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case ECollisionShape::Sphere:
|
||||
{
|
||||
if (const USphereComponent* SphereComponent = Cast<USphereComponent>(PrimitiveComponent))
|
||||
{
|
||||
FCogDebugDrawHelper::DrawSphere(
|
||||
World,
|
||||
SphereComponent->GetComponentLocation(),
|
||||
SphereComponent->GetScaledSphereRadius(),
|
||||
FCogDebug::GetCircleSegments(),
|
||||
Color,
|
||||
false,
|
||||
0.0f,
|
||||
FCogDebug::GetDebugDepthPriority(0),
|
||||
FCogDebug::GetDebugThickness(0.0f));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ECollisionShape::Capsule:
|
||||
{
|
||||
if (const UCapsuleComponent* CapsuleComponent = Cast<UCapsuleComponent>(PrimitiveComponent))
|
||||
{
|
||||
DrawDebugCapsule(World,
|
||||
CapsuleComponent->GetComponentLocation(),
|
||||
CapsuleComponent->GetScaledCapsuleHalfHeight(),
|
||||
CapsuleComponent->GetScaledCapsuleRadius(),
|
||||
CapsuleComponent->GetComponentQuat(),
|
||||
Color,
|
||||
false,
|
||||
0.0f,
|
||||
FCogDebug::GetDebugDepthPriority(0),
|
||||
FCogDebug::GetDebugThickness(0.0f));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
FCogDebugDrawSweepParams DrawParams;
|
||||
FCogDebug::GetDebugDrawSweepSettings(DrawParams);
|
||||
DrawParams.DrawHitNormals = false;
|
||||
DrawParams.DrawHitImpactNormals = false;
|
||||
DrawParams.DrawHitImpactPoints = false;
|
||||
DrawParams.DrawHitLocation = false;
|
||||
DrawParams.DrawHitPrimitives = true;
|
||||
DrawParams.DrawHitPrimitiveActorsName = Config->ShowActorsNames;
|
||||
FCogDebugDrawHelper::DrawSweep(GetWorld(), QueryShape, QueryStart, QueryEnd, FQuat::Identity, false, HitResults, DrawParams);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_CollisionViewer::SetAsset(const UCogEngineDataAsset* Value)
|
||||
{
|
||||
Asset = Value;
|
||||
|
||||
if (Asset == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (FChannel& Channel : Channels)
|
||||
{
|
||||
Channel.IsValid = false;
|
||||
}
|
||||
|
||||
for (const FCogCollisionChannel& AssetChannel : Asset->Channels)
|
||||
{
|
||||
FChannel& Channel = Channels[(uint8)AssetChannel.Channel];
|
||||
Channel.IsValid = true;
|
||||
Channel.Color = AssetChannel.Color.ToFColor(true);
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,13 @@ void FCogEngineWindow_DebugSettings::PreSaveConfig()
|
||||
Config->Data = FCogDebug::Settings;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void RenderCollisionChannelColor(const UCollisionProfile& CollisionProfile, FColor& Color, ECollisionChannel Channel, ImGuiColorEditFlags ColorEditFlags)
|
||||
{
|
||||
const FString ChannelName = CollisionProfile.ReturnChannelNameFromContainerIndex(Channel).ToString();
|
||||
FCogImguiHelper::ColorEdit4(StringCast<ANSICHAR>(*ChannelName).Get(), Color, ColorEditFlags);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void FCogEngineWindow_DebugSettings::RenderContent()
|
||||
{
|
||||
@@ -57,200 +64,210 @@ void FCogEngineWindow_DebugSettings::RenderContent()
|
||||
FCogDebug::Reset();
|
||||
}
|
||||
|
||||
ImGui::Checkbox("Show Advanced Settings", &Config->bShowAdvancedSettings);
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
|
||||
Config->Data.bIsFilteringBySelection = FCogDebug::GetIsFilteringBySelection();
|
||||
if (ImGui::Checkbox("Filter by selection", &Config->Data.bIsFilteringBySelection))
|
||||
{
|
||||
FCogDebug::SetIsFilteringBySelection(GetWorld(), Config->Data.bIsFilteringBySelection);
|
||||
}
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("If checked, only show the debug of the currently selected actor. Otherwise show the debug of all actors.");
|
||||
}
|
||||
|
||||
constexpr ImGuiColorEditFlags ColorEditFlags = ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf;
|
||||
FCogDebugSettings& Settings = FCogDebug::Settings;
|
||||
|
||||
ImGui::Checkbox("Persistent", &Settings.Persistent);
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
if (ImGui::CollapsingHeader("General", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
ImGui::SetTooltip("Make debug draw always persist");
|
||||
Config->Data.bIsFilteringBySelection = FCogDebug::GetIsFilteringBySelection();
|
||||
if (ImGui::Checkbox("Filter by selection", &Config->Data.bIsFilteringBySelection))
|
||||
{
|
||||
FCogDebug::SetIsFilteringBySelection(GetWorld(), Config->Data.bIsFilteringBySelection);
|
||||
}
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("If checked, only show the debug of the currently selected actor. Otherwise show the debug of all actors.");
|
||||
}
|
||||
|
||||
ImGui::Checkbox("Persistent", &Settings.Persistent);
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("Make debug draw always persist");
|
||||
}
|
||||
|
||||
ImGui::Checkbox("Text Shadow", &Settings.TextShadow);
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("Show a shadow below debug text.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::Checkbox("Fade 2D", &Settings.Fade2D);
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("Does the 2D debug is fading out.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Duration", &Settings.Duration, 0.01f, 0.0f, 100.0f, "%.1f");
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("The duration of debug elements.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Thickness", &Settings.Thickness, 0.05f, 0.0f, 5.0f, "%.1f");
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("The thickness of debug lines.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Server Thickness", &Settings.ServerThickness, 0.05f, 0.0f, 5.0f, "%.1f");
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("The thickness the server debug lines.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Server Color Mult", &Settings.ServerColorMultiplier, 0.01f, 0.0f, 1.0f, "%.1f");
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("The color multiplier applied to the server debug lines.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragInt("Depth Priority", &Settings.DepthPriority, 0.1f, 0, 100);
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("The depth priority of debug elements.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragInt("Segments", &Settings.Segments, 0.1f, 4, 20.0f);
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("The number of segments used for circular shapes.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Axes Scale", &Settings.AxesScale, 0.1f, 0, 10.0f, "%.1f");
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("The scaling debug axis.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Arrow Size", &Settings.ArrowSize, 1.0f, 0.0f, 200.0f, "%.0f");
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("The size of debug arrows.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gradient Intensity", &Settings.GradientColorIntensity, 0.01f, 0.0f, 1.0f, "%.2f");
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("How much the debug elements color should be changed by a gradient color over time.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gradient Speed", &Settings.GradientColorSpeed, 0.1f, 0.0f, 10.0f, "%.1f");
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("The speed of the gradient color change.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Text Size", &Settings.TextSize, 0.1f, 0.1f, 5.0f, "%.1f");
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("The size of the debug texts.");
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Checkbox("Text Shadow", &Settings.TextShadow);
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
if (ImGui::CollapsingHeader("Gizmo"))
|
||||
{
|
||||
ImGui::SetTooltip("Show a shadow below debug text.");
|
||||
}
|
||||
ImGui::SeparatorText("General");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::Checkbox("Fade 2D", &Settings.Fade2D);
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("Does the 2D debug is fading out.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Duration", &Settings.Duration, 0.01f, 0.0f, 100.0f, "%.1f");
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("The duration of debug elements.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Thickness", &Settings.Thickness, 0.05f, 0.0f, 5.0f, "%.1f");
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("The thickness of debug lines.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Server Thickness", &Settings.ServerThickness, 0.05f, 0.0f, 5.0f, "%.1f");
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("The thickness the server debug lines.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Server Color Mult", &Settings.ServerColorMultiplier, 0.01f, 0.0f, 1.0f, "%.1f");
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("The color multiplier applied to the server debug lines.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragInt("Depth Priority", &Settings.DepthPriority, 0.1f, 0, 100);
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("The depth priority of debug elements.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragInt("Segments", &Settings.Segments, 0.1f, 4, 20.0f);
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("The number of segments used for circular shapes.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Axes Scale", &Settings.AxesScale, 0.1f, 0, 10.0f, "%.1f");
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("The scaling debug axis.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Arrow Size", &Settings.ArrowSize, 1.0f, 0.0f, 200.0f, "%.0f");
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("The size of debug arrows.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gradient Intensity", &Settings.GradientColorIntensity, 0.01f, 0.0f, 1.0f, "%.2f");
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("How much the debug elements color should be changed by a gradient color over time.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gradient Speed", &Settings.GradientColorSpeed, 0.1f, 0.0f, 10.0f, "%.1f");
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("The speed of the gradient color change.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Text Size", &Settings.TextSize, 0.1f, 0.1f, 5.0f, "%.1f");
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("The size of the debug texts.");
|
||||
}
|
||||
|
||||
ImGui::SeparatorText("Gizmo");
|
||||
|
||||
ImGui::Checkbox("Gizmo Use Local Space", &Settings.GizmoUseLocalSpace);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gizmo Scale", &Settings.GizmoScale, 0.1f, 0.1f, 10.0f, "%.1f");
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("The scale of the gizmo.");
|
||||
}
|
||||
|
||||
if (Config->bShowAdvancedSettings)
|
||||
{
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragInt("Gizmo Z Low", &Settings.GizmoZLow, 0.5f, 0, 1000);
|
||||
ImGui::Checkbox("Use Local Space", &Settings.GizmoUseLocalSpace);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragInt("Gizmo Z High", &Settings.GizmoZHigh, 0.5f, 0, 1000);
|
||||
ImGui::DragFloat("Gizmo Scale", &Settings.GizmoScale, 0.1f, 0.1f, 10.0f, "%.1f");
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_Stationary))
|
||||
{
|
||||
ImGui::SetTooltip("The scale of the gizmo.");
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gizmo Thickness Z Low", &Settings.GizmoThicknessZLow, 0.1f, 0.0f, 10.0f, "%.1f");
|
||||
ImGui::DragInt("Z Low", &Settings.GizmoZLow, 0.5f, 0, 1000);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gizmo Thickness Z High", &Settings.GizmoThicknessZHigh, 0.1f, 0.0f, 10.0f, "%.1f");
|
||||
ImGui::DragInt("Z High", &Settings.GizmoZHigh, 0.5f, 0, 1000);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gizmo Mouse Max Distance", &Settings.GizmoCursorSelectionThreshold, 0.1f, 0.0f, 50.0f, "%.1f");
|
||||
ImGui::DragFloat("Thickness Z Low", &Settings.GizmoThicknessZLow, 0.1f, 0.0f, 10.0f, "%.1f");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::Checkbox("Gizmo Translation Snap Enable", &Settings.GizmoTranslationSnapEnable);
|
||||
ImGui::DragFloat("Thickness Z High", &Settings.GizmoThicknessZHigh, 0.1f, 0.0f, 10.0f, "%.1f");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gizmo Translation Snap", &Settings.GizmoTranslationSnapValue, 0.1f, 0.0f, 1000.0f, "%.1f");
|
||||
ImGui::DragFloat("Mouse Max Distance", &Settings.GizmoCursorSelectionThreshold, 0.1f, 0.0f, 50.0f, "%.1f");
|
||||
|
||||
ImGui::SeparatorText("Translation");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gizmo Translation Axis Length", &Settings.GizmoTranslationAxisLength, 0.1f, 0.1f, 500.0f, "%.1f");
|
||||
ImGui::Checkbox("Translation Snap Enable", &Settings.GizmoTranslationSnapEnable);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gizmo Translation Plane Offset", &Settings.GizmoTranslationPlaneOffset, 0.1f, 0.0f, 500.0f, "%.1f");
|
||||
ImGui::DragFloat("Translation Snap", &Settings.GizmoTranslationSnapValue, 0.1f, 0.0f, 1000.0f, "%.1f");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gizmo Translation Plane Extent", &Settings.GizmoTranslationPlaneExtent, 0.1f, 0.0f, 100.0f, "%.1f");
|
||||
ImGui::DragFloat("Translation Axis Length", &Settings.GizmoTranslationAxisLength, 0.1f, 0.1f, 500.0f, "%.1f");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::Checkbox("Gizmo Rotation Snap Enable", &Settings.GizmoRotationSnapEnable);
|
||||
ImGui::DragFloat("Translation Plane Offset", &Settings.GizmoTranslationPlaneOffset, 0.1f, 0.0f, 500.0f, "%.1f");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gizmo Rotation Snap", &Settings.GizmoRotationSnapValue, 0.1f, 0.0f, 360.0f, "%.1f");
|
||||
ImGui::DragFloat("Translation Plane Extent", &Settings.GizmoTranslationPlaneExtent, 0.1f, 0.0f, 100.0f, "%.1f");
|
||||
|
||||
ImGui::SeparatorText("Rotation");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gizmo Rotation Speed", &Settings.GizmoRotationSpeed, 0.01f, 0.01f, 100.0f, "%.2f");
|
||||
ImGui::Checkbox("Rotation Snap Enable", &Settings.GizmoRotationSnapEnable);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gizmo Rotation Radius", &Settings.GizmoRotationRadius, 0.1f, 0.1f, 500.0f, "%.1f");
|
||||
ImGui::DragFloat("Rotation Snap", &Settings.GizmoRotationSnapValue, 0.1f, 0.0f, 360.0f, "%.1f");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragInt("Gizmo Rotation Segments", &Settings.GizmoRotationSegments, 0.5f, 2, 12);
|
||||
ImGui::DragFloat("Rotation Speed", &Settings.GizmoRotationSpeed, 0.01f, 0.01f, 100.0f, "%.2f");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::Checkbox("Gizmo Scale Snap Enable", &Settings.GizmoScaleSnapEnable);
|
||||
ImGui::DragFloat("Rotation Radius", &Settings.GizmoRotationRadius, 0.1f, 0.1f, 500.0f, "%.1f");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gizmo Scale Snap", &Settings.GizmoScaleSnapValue, 0.1f, 0.0f, 10.0f, "%.1f");
|
||||
ImGui::DragInt("Rotation Segments", &Settings.GizmoRotationSegments, 0.5f, 2, 12);
|
||||
|
||||
ImGui::SeparatorText("Scale");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gizmo Scale Box Offset", &Settings.GizmoScaleBoxOffset, 0.0f, 0.0f, 500.0f, "%.1f");
|
||||
ImGui::Checkbox("Scale Snap Enable", &Settings.GizmoScaleSnapEnable);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gizmo Scale Box Extent", &Settings.GizmoScaleBoxExtent, 0.1f, 0.0f, 100.0f, "%.1f");
|
||||
ImGui::DragFloat("Scale Snap", &Settings.GizmoScaleSnapValue, 0.1f, 0.0f, 10.0f, "%.1f");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gizmo Scale Speed", &Settings.GizmoScaleSpeed, 0.01f, 0.01f, 100.0f, "%.2f");
|
||||
ImGui::DragFloat("Scale Box Offset", &Settings.GizmoScaleBoxOffset, 0.0f, 0.0f, 500.0f, "%.1f");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gizmo Scale Min", &Settings.GizmoScaleMin, 0.001f, 0.001f, 1.0f, "%.3f");
|
||||
ImGui::DragFloat("Scale Box Extent", &Settings.GizmoScaleBoxExtent, 0.1f, 0.0f, 100.0f, "%.1f");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gizmo Ground Raycast Length", &Settings.GizmoGroundRaycastLength, 10.0f, 0.0f, 1000000.0f, "%.0f");
|
||||
ImGui::DragFloat("Scale Speed", &Settings.GizmoScaleSpeed, 0.01f, 0.01f, 100.0f, "%.2f");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Scale Min", &Settings.GizmoScaleMin, 0.001f, 0.001f, 1.0f, "%.3f");
|
||||
|
||||
ImGui::SeparatorText("Ground Raycast");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Ground Raycast Length", &Settings.GizmoGroundRaycastLength, 10.0f, 0.0f, 1000000.0f, "%.0f");
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ECollisionChannel Channel = Settings.GizmoGroundRaycastChannel.GetValue();
|
||||
@@ -260,26 +277,90 @@ void FCogEngineWindow_DebugSettings::RenderContent()
|
||||
}
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Gizmo Ground Raycast Circle Radius", &Settings.GizmoGroundRaycastCircleRadius, 0.1f, 0.1f, 1000.0f, "%.1f");
|
||||
ImGui::DragFloat("Ground Raycast Circle Radius", &Settings.GizmoGroundRaycastCircleRadius, 0.1f, 0.1f, 1000.0f, "%.1f");
|
||||
|
||||
FCogImguiHelper::ColorEdit4("Gizmo Axis Colors ZLow X", Settings.GizmoAxisColorsZLowX, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
FCogImguiHelper::ColorEdit4("Gizmo Axis Colors ZLow Y", Settings.GizmoAxisColorsZLowY, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
FCogImguiHelper::ColorEdit4("Gizmo Axis Colors ZLow Z", Settings.GizmoAxisColorsZLowZ, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
FCogImguiHelper::ColorEdit4("Gizmo Axis Colors ZLow W", Settings.GizmoAxisColorsZLowW, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
FCogImguiHelper::ColorEdit4("Ground Raycast Color", Settings.GizmoGroundRaycastColor, ColorEditFlags);
|
||||
FCogImguiHelper::ColorEdit4("Ground Raycast Circle Color", Settings.GizmoGroundRaycastCircleColor, ColorEditFlags);
|
||||
|
||||
FCogImguiHelper::ColorEdit4("Gizmo Axis Colors ZHigh X", Settings.GizmoAxisColorsZHighX, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
FCogImguiHelper::ColorEdit4("Gizmo Axis Colors ZHigh Y", Settings.GizmoAxisColorsZHighY, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
FCogImguiHelper::ColorEdit4("Gizmo Axis Colors ZHigh Z", Settings.GizmoAxisColorsZHighZ, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
FCogImguiHelper::ColorEdit4("Gizmo Axis Colors ZHigh W", Settings.GizmoAxisColorsZHighW, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
ImGui::SeparatorText("Axis Colors");
|
||||
|
||||
FCogImguiHelper::ColorEdit4("Gizmo Axis Colors Selection X", Settings.GizmoAxisColorsSelectionX, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
FCogImguiHelper::ColorEdit4("Gizmo Axis Colors Selection Y", Settings.GizmoAxisColorsSelectionY, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
FCogImguiHelper::ColorEdit4("Gizmo Axis Colors Selection Z", Settings.GizmoAxisColorsSelectionZ, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
FCogImguiHelper::ColorEdit4("Gizmo Axis Colors Selection W", Settings.GizmoAxisColorsSelectionW, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
FCogImguiHelper::ColorEdit4("Axis Colors ZLow X", Settings.GizmoAxisColorsZLowX, ColorEditFlags);
|
||||
FCogImguiHelper::ColorEdit4("Axis Colors ZLow Y", Settings.GizmoAxisColorsZLowY, ColorEditFlags);
|
||||
FCogImguiHelper::ColorEdit4("Axis Colors ZLow Z", Settings.GizmoAxisColorsZLowZ, ColorEditFlags);
|
||||
FCogImguiHelper::ColorEdit4("Axis Colors ZLow W", Settings.GizmoAxisColorsZLowW, ColorEditFlags);
|
||||
|
||||
FCogImguiHelper::ColorEdit4("Gizmo Text Color", Settings.GizmoTextColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
FCogImguiHelper::ColorEdit4("Axis Colors ZHigh X", Settings.GizmoAxisColorsZHighX, ColorEditFlags);
|
||||
FCogImguiHelper::ColorEdit4("Axis Colors ZHigh Y", Settings.GizmoAxisColorsZHighY, ColorEditFlags);
|
||||
FCogImguiHelper::ColorEdit4("Axis Colors ZHigh Z", Settings.GizmoAxisColorsZHighZ, ColorEditFlags);
|
||||
FCogImguiHelper::ColorEdit4("Axis Colors ZHigh W", Settings.GizmoAxisColorsZHighW, ColorEditFlags);
|
||||
|
||||
FCogImguiHelper::ColorEdit4("Gizmo Ground Raycast Color", Settings.GizmoGroundRaycastColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
FCogImguiHelper::ColorEdit4("Gizmo Ground Raycast Circle Color", Settings.GizmoGroundRaycastCircleColor, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||
FCogImguiHelper::ColorEdit4("Axis Colors Selection X", Settings.GizmoAxisColorsSelectionX, ColorEditFlags);
|
||||
FCogImguiHelper::ColorEdit4("Axis Colors Selection Y", Settings.GizmoAxisColorsSelectionY, ColorEditFlags);
|
||||
FCogImguiHelper::ColorEdit4("Axis Colors Selection Z", Settings.GizmoAxisColorsSelectionZ, ColorEditFlags);
|
||||
FCogImguiHelper::ColorEdit4("Axis Colors Selection W", Settings.GizmoAxisColorsSelectionW, ColorEditFlags);
|
||||
|
||||
FCogImguiHelper::ColorEdit4("Text Color", Settings.GizmoTextColor, ColorEditFlags);
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Collision Channels"))
|
||||
{
|
||||
if (const UCollisionProfile* CollisionProfile = UCollisionProfile::Get())
|
||||
{
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorWorldStatic, ECC_WorldStatic, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorWorldDynamic, ECC_WorldDynamic, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorPawn, ECC_Pawn, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorVisibility, ECC_Visibility, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorCamera, ECC_Camera, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorPhysicsBody, ECC_PhysicsBody, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorVehicle, ECC_Vehicle, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorDestructible, ECC_Destructible, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorEngineTraceChannel1, ECC_EngineTraceChannel1, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorEngineTraceChannel2, ECC_EngineTraceChannel2, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorEngineTraceChannel3, ECC_EngineTraceChannel3, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorEngineTraceChannel4, ECC_EngineTraceChannel4, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorEngineTraceChannel5, ECC_EngineTraceChannel5, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorEngineTraceChannel6, ECC_EngineTraceChannel6, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorGameTraceChannel1, ECC_GameTraceChannel1, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorGameTraceChannel2, ECC_GameTraceChannel2, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorGameTraceChannel3, ECC_GameTraceChannel3, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorGameTraceChannel4, ECC_GameTraceChannel4, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorGameTraceChannel5, ECC_GameTraceChannel5, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorGameTraceChannel6, ECC_GameTraceChannel6, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorGameTraceChannel7, ECC_GameTraceChannel7, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorGameTraceChannel8, ECC_GameTraceChannel8, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorGameTraceChannel9, ECC_GameTraceChannel9, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorGameTraceChannel10, ECC_GameTraceChannel10, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorGameTraceChannel11, ECC_GameTraceChannel11, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorGameTraceChannel12, ECC_GameTraceChannel12, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorGameTraceChannel13, ECC_GameTraceChannel13, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorGameTraceChannel14, ECC_GameTraceChannel14, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorGameTraceChannel15, ECC_GameTraceChannel15, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorGameTraceChannel16, ECC_GameTraceChannel16, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorGameTraceChannel17, ECC_GameTraceChannel17, ColorEditFlags);
|
||||
RenderCollisionChannelColor(*CollisionProfile, Settings.ChannelColorGameTraceChannel18, ECC_GameTraceChannel18, ColorEditFlags);
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Collision Query"))
|
||||
{
|
||||
ImGui::Checkbox("Draw Hit Primitives", &Settings.CollisionQueryDrawHitPrimitives);
|
||||
ImGui::Checkbox("Draw Hit Primitive Actors Name", &Settings.CollisionQueryDrawHitPrimitiveActorsName);
|
||||
ImGui::Checkbox("Prim Hit Primitive Actors Name Shadow", &Settings.CollisionQueryHitPrimitiveActorsNameShadow);
|
||||
ImGui::Checkbox("Draw Hit Shapes", &Settings.CollisionQueryDrawHitShapes);
|
||||
ImGui::Checkbox("Draw Hit Location", &Settings.CollisionQueryDrawHitLocation);
|
||||
ImGui::Checkbox("Draw Hit Impact Points", &Settings.CollisionQueryDrawHitImpactPoints);
|
||||
ImGui::Checkbox("Draw Hit Normals", &Settings.CollisionQueryDrawHitNormals);
|
||||
ImGui::Checkbox("Draw Hit Impact Normals", &Settings.CollisionQueryDrawHitImpactNormals);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Primitive Actors Name Size", &Settings.CollisionQueryHitPrimitiveActorsNameSize);
|
||||
|
||||
FCogWindowWidgets::SetNextItemToShortWidth();
|
||||
ImGui::DragFloat("Hit Point Size", &Settings.CollisionQueryHitPointSize);
|
||||
|
||||
FCogImguiHelper::ColorEdit4("Hit Color", Settings.CollisionQueryHitColor, ColorEditFlags);
|
||||
FCogImguiHelper::ColorEdit4("No Hit Color", Settings.CollisionQueryNoHitColor, ColorEditFlags);
|
||||
FCogImguiHelper::ColorEdit4("Normal Color", Settings.CollisionQueryNormalColor, ColorEditFlags);
|
||||
FCogImguiHelper::ColorEdit4("Impact Normal Color", Settings.CollisionQueryImpactNormalColor, ColorEditFlags);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user