Why is Sphere trace not returning hit with landscape?

I’ve never encountered this before… I’m running a very basic sphere trace and it’s not returning a hit from the landscape. I did not change the collision for the landscape.

This is my code:


This is my result:

  • Trace channel visibility is the one you want to use?
  • The impacts of you shots are traced against visibility too? Or is this handled by projectile physic query?

I assume the hit didn’t even trigger, so the hit location and doOnce is to ignore for debug purposes.
Ill recreate that quickly.

Update:

So basically that will work just fine for my landscape. It uses default collision settings and im tracing against visibility.
So probably check your tracing channel settings.

Or try to use trace by objects:


You can than fill your variable with the the desired presets and test it with that.

regards
wefl aka ralf

1 Like

You could try using “trace complex” if that doesn’t help you could try checking if your landscape is set to block the visibility channel in the collision presets and try making it collision enabled query and physics.

1 Like

Yeah, my weapons are using the visibility channel which is why this doesn’t make any sense. Also, I did try using sphere trace for objects and set every object type in the array, but that still didn’t work. What object type is the landscape anyway? I assumed World Static.

Yeah, I’ve tried trace complex too, and I also checked the collision settings on my landscape, which I said are at the default and they ARE set to block visibility. This is why I’m here, it doesn’t make sense.

Just an idea to help
I would try to debug the name of hit actor. The hit could occur on something else than the landscape (I know it wouldn’t explain why the hit works on the floor mesh).
I would try also with multi sphere trace and see which actors are hit.
It could give clues

1 Like

I might be missing something here given all the chat on debug but you seem to have a trace length of zero because you have the start and end wired in from the same pin - You need to start at get world location and then trace forward (Get look direction or if you just want to find the ground -z ) to another end vector location.

2 Likes

It’s a sphere trace, not a line trace. Lol. The start and end define the shape and the radius sets the size. Watch the video, it shows it working :slight_smile:

The issue is there’s no hit. The sphere remains red. It’s as if the landscape doesn’t have collision, but as I said it works for my line traces so it doesn’t make sense.

Have you tried increasing the collision thickness of the landscape to see if that does anything? You can use “Make Array” and directly select your landscape channel for where you have your object types variable if that may be a culprit…?

Edit: I think I was looking at the other guys post… Looks like you’re using just sphere trace. SphereTraceForObjects works for me using the “Make Array” and selecting Landscape…

Landcape isn’t an option in the Enum for Sphere Trace For Objects. That’s why I was asking what Object Type it is. If you’ve got Landscape as an option, then it’s a custom collision channel and not an engine default. Either that, or my engine is broken.
ObjectTypes

And no idea how to change the thickness of landscape collision so I’ll look into that. Thanks!

Oh, thickness is depreciated since 4.14 :frowning:

“PxHeightFieldDesc::thickness has been deprecated, as the new unified height field (see PxRegisterUnifiedHeightFields()) does not support thickness any longer.”

If you are using UE4 4.14 or later you will no longer be able to use the ‘CollisionThickness’ property in your landscape actors, as the underlying code is deprecated."

1 Like

Yes sorry that’s my bad. Looking at it again I did set that up separately, but it was because of a very similar issue you’re having… You might could give a custom channel a try if doesn’t mess up everything else… Anyway, I hope you can get it working.

So I recreated this in a fresh 4.27 project and got the same results. Hit is not returned from the trace when there’s a landscape involved. What’s more interesting is that if I use a line trace instead of a sphere trace, I DO get a hit result from the landscape.

I guess I’ll submit this as a bug unless someone knows why this is happening?

1 Like

Ah ha! Apparently it’s an already reported bug. Unreal Engine Issues and Bug Tracker (UE-68641)

If you use the same start and end location for a sphere trace (which should technically work) it will not return a hit. So the workaround is just to add another vector in there with 1,1,1 and it will return a hit from Landscape. Weird that it works on static meshes and not the landscape.

6 Likes

from the future, I have to tell u, thank you so much

1 Like