Summary
No Hits on Landscape when using the Entity.FindSweepHits() to find what is below my Prefab Entity
Please select what you are reporting on:
Unreal Editor for Fortnite
What Type of Bug are you experiencing?
Verse
Steps to Reproduce
Create a Prefab with a single Entity. Add a mesh_component, transform_component and the following verse component.
using { /Verse.org/Simulation }
using { /Verse.org/SceneGraph }
using { /Verse.org/SpatialMath }
using { /Verse.org/Colors }
using { /UnrealEngine.com/Temporary/Diagnostics }
sweep_test_component := class<final_super>(component):
DownwardSweepDistance:float = 10000.0 # 100m
DebugDraw:debug_draw = debug_draw{}
OnBeginSimulation<override>():void =
# Call parent implementation first
(super:)OnBeginSimulation()
spawn:
RunLogic()
RunLogic()<suspends>:void =
loop:
CurrentDistanceFromGround()
Sleep(0.2)
CurrentDistanceFromGround():float =
StartTransform := Entity.GetGlobalTransform()
Displacement := vector3{Up := -1.0} * DownwardSweepDistance
Extent := vector3{Up := 10.0, Left := 60.0, Forward := 90.0}
Offset:float = 15.0
CollisionVolume := collision_box{Extents := Extent, Collidable := true, Queryable := true}
OffsetStartTransform := transform{
Translation := StartTransform.Translation + vector3{Up := -Offset},
Rotation := StartTransform.Rotation,
Scale := StartTransform.Scale
}
# Debug
StartPoint := StartTransform.Translation
EndPoint := StartPoint + Displacement
DebugDraw.DrawBox(Center := OffsetStartTransform.Translation, Rotation := OffsetStartTransform.Rotation, ?Extent := Extent, ?Color := NamedColors.LightGray, ?Duration := 0.2)
# If we find any Hits, how far away are they?
var ClosestDistance:float = DownwardSweepDistance
var FoundAny : logic = false
for (Hit : Entity.FindSweepHits(Displacement, OffsetStartTransform, CollisionVolume)):
if (Hit.TargetComponent.Entity <> Entity):
DebugDraw.DrawSphere(Hit.ContactPosition, ?Radius := 10.0, ?Color := NamedColors.Yellow, ?Duration := 0.2)
CalculatedDistance:float = StartTransform.Translation.Up - Hit.ContactPosition.Up
if (CalculatedDistance > 0.0 and CalculatedDistance < ClosestDistance):
set ClosestDistance = CalculatedDistance
set FoundAny = true
else:
DebugDraw.DrawSphere(Hit.ContactPosition, ?Radius := 10.0, ?Color := NamedColors.Green, ?Duration := 0.2)
if (FoundAny?):
DebugDraw.DrawLine(StartPoint, EndPoint, ?Color := NamedColors.Blue, ?Duration := 0.2, ?Thickness := 10.0)
return ClosestDistance
else:
DebugDraw.DrawLine(StartPoint, EndPoint, ?Color := NamedColors.Red, ?Duration := 0.2, ?Thickness := 10.0)
Print(Message := "Ground NOT found!", ?Duration := 5.0, ?Color := NamedColors.Red)
return -1.0
Add some basic Landscape to the map. Drag and drop a number of the Entity into the world and run.
The verse script will draw a blue line if it encounters a sweep hit below itself within 100m. It will draw a yellow sphere at the point of the hit. Otherwise, it will draw a red line. A white box is drawn to represent the collision volume. And a green sphere is used to represent the start point of the sweep.
Expected Result
The line should be blue when over landscape with a yellow sphere at the ground level.
Observed Result
The sweep passes through the landscape without recording a hit.
Platform(s)
Windows
Upload an image
Additional Notes
I’ve tried a number of variations on the verse i.e. with and without a collision volume, with and without an offset. The result always the same.



