Does boxtrace work the same as linetrace or is it broken?

I was surprised to discover that boxtrace works like linetrace, but I don’t understand what the point is in using it at all.
Is this a bug or is it intended to be like this?
Boxtrace hits collision if it crosses the middle of it. I can replace boxtrace with lintrace and will get the same result.

  • if I line trace, I will miss:

image

  • If I box trace, I will hit:

image


If you’re getting a different result, something is not set up correctly.

I thought the same as you, but in practice boxtrace doesn’t work that way.

Yeah, they do.

Nope. I tried spheretrace and it works but boxtrace does not


Have a look. Spheretrace works as intended
There is no issue with collision settings or with trace channels

The issue is something else than the box trace. Be mindful of how Extent works, especially after rotating.

I can’t even imagine where it might be because it hits the target but in a broken manner. This is so weird.

PS Yes I know how box extent works :slightly_smiling_face:

Are you using Orientation?

Yes. World rotation of the arrow component which is directed to the side

Simple stuff
RightSideCentralTrace is arrow component

image

is this is a static value? Can you try with it punched in manually, just to test. Hard to imagine it without seeing the whole thing.


Are you deriving those values from components bounds?

Be mindful of how Extent works, especially after rotating.

There’s no need to update the Half Size (extent) if you’re changing orientation. Try with orientation only - see how it goes. Set the Half Size only once, at Begin Play, don’t update it later.

1 Like

Omg it works now. Will check the variable. I get it From GetScaledBoxExtent
Thank you very much!

1 Like

I make this box extent once in construction script but need to check the output, why it looks right but boxtrace doesn’t work

And that’s another potential trap UE sets for you. Due to the way comps are re-instantiated, we cannot always rely on their data in the CS. I learnt it the hard way a couple of ways ago. The entry is in the bug DB but is flagged as Won’t Fix. Acknowledged but Waived.

It may work here & there but through the sheer force of habit I set the value once on Begin Play and only update it when the size actually changes - let’s say you added a giant cargo hold that pokes out to the spaceship (?).


In short:

The component forgets where it is, for example.

1 Like

Thanks for the detailed information, I’ll try to avoid this problem.

Fortunately, I don’t need to change the size of the ship in runtime. I’ll do it all on beginplay

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.