mirror of
https://github.com/sinbad/StevesUEHelpers.git
synced 2025-02-23 09:35:25 +00:00
Add boxes
This commit is contained in:
parent
1b8a5a805c
commit
266c8cc1b8
@ -67,6 +67,15 @@ FPrimitiveSceneProxy* UStevesEditorVisComponent::CreateSceneProxy()
|
||||
S.Colour
|
||||
));
|
||||
}
|
||||
for (auto& Box : Boxes)
|
||||
{
|
||||
FVector HalfSize = Box.Size * 0.5f;
|
||||
FBox DBox(-HalfSize, HalfSize);
|
||||
// Apply local rotation first then parent transform
|
||||
FTransform CombinedXForm = FTransform(Box.Rotation, Box.Location) * XForm;
|
||||
Ret->Boxes.Add(FStevesDebugRenderSceneProxy::FDebugBox(
|
||||
DBox, Box.Colour, CombinedXForm));
|
||||
}
|
||||
|
||||
return Ret;
|
||||
|
||||
@ -102,7 +111,15 @@ FBoxSphereBounds UStevesEditorVisComponent::CalcBounds(const FTransform& LocalTo
|
||||
{
|
||||
B = B + FBoxSphereBounds(S.Location, FVector(S.Radius), S.Radius);
|
||||
}
|
||||
|
||||
for (auto& Box : Boxes)
|
||||
{
|
||||
FVector HalfSize = Box.Size * 0.5f;
|
||||
FBox DBox(-HalfSize, HalfSize);
|
||||
// Apply local rotation only, world is done later
|
||||
FTransform BoxXForm = FTransform(Box.Rotation, Box.Location);
|
||||
DBox = DBox.TransformBy(BoxXForm);
|
||||
B = B + FBoxSphereBounds(DBox);
|
||||
}
|
||||
return B.TransformBy(LocalToWorld);
|
||||
}
|
||||
|
||||
|
@ -22,17 +22,17 @@ struct FStevesEditorVisLine
|
||||
UPROPERTY(EditAnywhere)
|
||||
FColor Colour;
|
||||
|
||||
FStevesEditorVisLine(const FVector& InStart, const FVector& InEnd,
|
||||
const FColor& InColour)
|
||||
FStevesEditorVisLine(const FVector& InStart, const FVector& InEnd,
|
||||
const FColor& InColour)
|
||||
: Start(InStart),
|
||||
End(InEnd),
|
||||
Colour(Colour)
|
||||
End(InEnd),
|
||||
Colour(Colour)
|
||||
{
|
||||
}
|
||||
|
||||
FStevesEditorVisLine():
|
||||
Start(FVector::ZeroVector),
|
||||
End(FVector(100,0,0)),
|
||||
End(FVector(100, 0, 0)),
|
||||
Colour(FColor::White)
|
||||
{
|
||||
}
|
||||
@ -60,7 +60,7 @@ struct FStevesEditorVisCircle
|
||||
FColor Colour;
|
||||
|
||||
FStevesEditorVisCircle(const FVector& InLocation, const FRotator& InRotation, float InRadius, int InNumSegments,
|
||||
const FColor& InColour)
|
||||
const FColor& InColour)
|
||||
: Location(InLocation),
|
||||
Rotation(InRotation),
|
||||
Radius(InRadius),
|
||||
@ -159,6 +159,41 @@ struct FStevesEditorVisSphere
|
||||
}
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FStevesEditorVisBox
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
/// Location relative to component
|
||||
UPROPERTY(EditAnywhere)
|
||||
FVector Location;
|
||||
/// Size of box in each axis
|
||||
UPROPERTY(EditAnywhere)
|
||||
FVector Size;
|
||||
/// Rotation relative to component
|
||||
UPROPERTY(EditAnywhere)
|
||||
FRotator Rotation;
|
||||
/// The colour of the line render
|
||||
UPROPERTY(EditAnywhere)
|
||||
FColor Colour;
|
||||
|
||||
FStevesEditorVisBox(const FVector& InLocation, const FVector& InSize, const FRotator& InRot,
|
||||
const FColor& InColour) :
|
||||
Location(InLocation),
|
||||
Size(InSize),
|
||||
Rotation(InRot),
|
||||
Colour(InColour)
|
||||
{
|
||||
}
|
||||
|
||||
FStevesEditorVisBox():
|
||||
Location(FVector::ZeroVector),
|
||||
Size(FVector(50, 50, 50)),
|
||||
Rotation(FRotator::ZeroRotator),
|
||||
Colour(FColor::White)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -190,6 +225,8 @@ public:
|
||||
TArray<FStevesEditorVisArc> Arcs;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TArray<FStevesEditorVisSphere> Spheres;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TArray<FStevesEditorVisBox> Boxes;
|
||||
|
||||
UStevesEditorVisComponent(const FObjectInitializer& ObjectInitializer);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user