mirror of
https://github.com/sinbad/StevesUEHelpers.git
synced 2025-02-23 09:35:25 +00:00
Add arrows and spheres
This commit is contained in:
parent
618fc84c32
commit
1b8a5a805c
@ -33,6 +33,11 @@ FPrimitiveSceneProxy* UStevesEditorVisComponent::CreateSceneProxy()
|
||||
Ret->Lines.Add(FDebugRenderSceneProxy::FDebugLine(XForm.TransformPosition(L.Start),
|
||||
XForm.TransformPosition(L.End), L.Colour));
|
||||
}
|
||||
for (auto& A : Arrows)
|
||||
{
|
||||
Ret->ArrowLines.Add(FDebugRenderSceneProxy::FArrowLine(XForm.TransformPosition(A.Start),
|
||||
XForm.TransformPosition(A.End), A.Colour));
|
||||
}
|
||||
for (auto& C : Circles)
|
||||
{
|
||||
FQuat WorldRot = XForm.TransformRotation(C.Rotation.Quaternion());
|
||||
@ -54,6 +59,14 @@ FPrimitiveSceneProxy* UStevesEditorVisComponent::CreateSceneProxy()
|
||||
Arc.NumSegments, Arc.Colour
|
||||
));
|
||||
}
|
||||
for (auto& S : Spheres)
|
||||
{
|
||||
Ret->Spheres.Add(FStevesDebugRenderSceneProxy::FSphere(
|
||||
XForm.GetMaximumAxisScale() * S.Radius,
|
||||
XForm.TransformPosition(S.Location),
|
||||
S.Colour
|
||||
));
|
||||
}
|
||||
|
||||
return Ret;
|
||||
|
||||
@ -70,6 +83,12 @@ FBoxSphereBounds UStevesEditorVisComponent::CalcBounds(const FTransform& LocalTo
|
||||
FVector Extents = L.Start.GetAbs().ComponentMax(L.End.GetAbs());
|
||||
B = B + FBoxSphereBounds(FVector::ZeroVector, Extents, Extents.GetMax());
|
||||
}
|
||||
for (auto& A : Arrows)
|
||||
{
|
||||
// Re-centre the origin of the line to make box extents
|
||||
FVector Extents = A.Start.GetAbs().ComponentMax(A.End.GetAbs());
|
||||
B = B + FBoxSphereBounds(FVector::ZeroVector, Extents, Extents.GetMax());
|
||||
}
|
||||
for (auto& C : Circles)
|
||||
{
|
||||
B = B + FBoxSphereBounds(C.Location, FVector(C.Radius), C.Radius);
|
||||
@ -79,6 +98,10 @@ FBoxSphereBounds UStevesEditorVisComponent::CalcBounds(const FTransform& LocalTo
|
||||
// Just use the entire circle for simplicity
|
||||
B = B + FBoxSphereBounds(Arc.Location, FVector(Arc.Radius), Arc.Radius);
|
||||
}
|
||||
for (auto& S : Spheres)
|
||||
{
|
||||
B = B + FBoxSphereBounds(S.Location, FVector(S.Radius), S.Radius);
|
||||
}
|
||||
|
||||
return B.TransformBy(LocalToWorld);
|
||||
}
|
||||
|
@ -129,6 +129,38 @@ struct FStevesEditorVisArc
|
||||
}
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FStevesEditorVisSphere
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
/// Location relative to component
|
||||
UPROPERTY(EditAnywhere)
|
||||
FVector Location;
|
||||
/// Sphere radius
|
||||
UPROPERTY(EditAnywhere)
|
||||
float Radius;
|
||||
/// The colour of the line render
|
||||
UPROPERTY(EditAnywhere)
|
||||
FColor Colour;
|
||||
|
||||
FStevesEditorVisSphere(const FVector& InLocation, float InRadius, const FColor& InColour) :
|
||||
Location(InLocation),
|
||||
Radius(InRadius),
|
||||
Colour(InColour)
|
||||
{
|
||||
}
|
||||
|
||||
FStevesEditorVisSphere():
|
||||
Location(FVector::ZeroVector),
|
||||
Radius(50),
|
||||
Colour(FColor::White)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* A component that solely exists to provide arbitrary editor visualisation when not selected.
|
||||
@ -151,9 +183,13 @@ public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TArray<FStevesEditorVisLine> Lines;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TArray<FStevesEditorVisLine> Arrows;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TArray<FStevesEditorVisCircle> Circles;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TArray<FStevesEditorVisArc> Arcs;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TArray<FStevesEditorVisSphere> Spheres;
|
||||
|
||||
UStevesEditorVisComponent(const FObjectInitializer& ObjectInitializer);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user