I noticed that I’m getting inconsistent overlap detections when using “Sphere Overlap Actors” to detect overlaps with the landscape…well, I’m looking for Actor, but I noticed the problem with landscape. It seems like the sphere overlap center needs to be below the landscape, or at least close to the landscape, to detect the overlap with the landscape.
I tried a similar test using a “Box Overlap Actors” and it appears to work as expected regardless of its position relative to the landscape. I have a sample actor for each test that will draw a sphere/box using either green or red depending on the overlap result.
The overlap test is clearly overlapping the landscape in my sample for both overlap tests, but only the box detects the overlap. In my tests the sphere overlap radius is equal to the box overlap extents which is 85 units.
Also, this is in UE 5.1.1 if that helps.
Is this expected behavior for sphere overlaps?
I can post my BP for both of my samples if that will help, but they’re very basic.
while in PIE
if you toggle Show Collision (hit “Tilda” the button commonly next to “1” in the number row, and type “show collision” it should show up in purple after the word “show”, and you can use arrow keys to select it)
does the collider displayed match your expectation? could an offset be off somewhere?
are you sure the collision preset or interaction chart is correct for the given colliders?
when you say “landscape” is this a terrain? how is this being created?
The collision looks fine and it’s just a default UE Landscape with some very minor hills created with the built in UE landscape sculpting tool. Nothing is being dynamically loaded, just a super simple static level with UE landscape.
The box overlap test works fine in the same location that the sphere overlap test is failing. If I put the center of the sphere overlap test closer to the landscape, or beneath it, the overlap test does finally succeed.
Let me attach a couple of screenshots showing the results of the overlap tests using draw debug sphere/box respectively. Green means it found an overlap and red means no overlap found.
In the below image I have the center for both at the same location. The radius for the sphere overlap test is 85 and the extent for the box overlap is {85,85,85}. It shows clearly that they’re both overlapping the landscape, but the sphere is failing.
And here’s the actor for testing the sphere overlap which is mostly the same as the box test just with spheres. As shown above the sphere does not always succeed when overlapping the landscape.
move these checks into tick(), constrain the tick to 1 second, so that you can run multiple tests in a PIE
do you get similar behavior:
do you get different behavior on frame 1+ verse frame 0?
does moving the actor at runtime make it work as expected?
on a flat part of the terrain?
if you get close to a steeper part of the terrain does that work better?
if you put the actor onto a plane or cube (that is part of WorldStatic) does it behave with those?
your cube/box lower-Z-Bound looks lower then the Radius of the sphere, are you sure the Cube is not interpenetrating the ground itself (it kind of looks like it is)
could you try to enlarge the radius on your sphere to see if that helps.
I have a list for each of your questions/suggestions, then I have some images below for some of them.
I moved everything to be within tick with no change.
No difference between frame 0 or 1+
Moving the sphere test actor around doesn’t change overlap success for the sphere unless moving the center either very close to or below the landscape just like before
Moved to flat terrain with no change to the issue
Moved the sphere next to a steeper part of the terrain with no change (I actually thought this would work)
Putting over a static mesh cube allows the sphere to work as expected
The lower z-bound is the same between the sphere and box, it’s just difficult to tell in that screenshot.
Enlarging the sphere by over 10x without moving the center results in similar issue
Just to re-iterate, if I push the sphere center very close or below the landscape then it works and the box overlap always works. Just wanted to mention so there’s no question the landscape is blocking properly.
Here’s an image showing the lower z-bound of the sphere and box being aligned.
Here’s an image of the sphere enlarged by 10x dwarfing the box overlap and both have the same center location. The box overlap succeeds, as usual, and the sphere overlap still fails.
And one more image where I added a cube at the very bottom of the enlarged sphere overlap to show that it is checking overlaps that far out, it just misses the landscape for some reason.
Moving the center of the enlarged sphere down even more does eventually allow it to detect the landscape just like with the smaller sphere.