Check what a line trace hits with first

Hey, i’m working on a physics pick up system. I’ve had the issue where the player can pick up objects through walls. My attempts to fix this have made it so if the second like trace (which is looking for walls) hits the floor after the object it will count it as a wall hit.

TLDR: I want to check if a line trace hit a wall or phys object first to decide weather an item should be picked up.

Thanks in advance

trace will just trigger ONLY the first hit.
It seems you wall is not stopping the trace at all…
have you checked your wall settings are fine
generating hit events for your trace?

you using two independent traces? why?

you can create a custom trace channel in project settings…call it
blocker for pickups and set your pickup items AND the ball to block this
channel. so you just use a single line trace filtered with that channel.

The walls should be generating hit events yes, and Im using 2 traces as to filter for objects and one for channels to filter for walls. Ill try the other solution you proposed.

you can filter by using tags.
linetrace everithing and when you have some succesfull hit just check if
the actor or component has some custom tag like ‘pickup item’. if not just ignore the trace.

How would i filter through tags from a line trace? would it be for objects or channels?

here you check if the hit actor has you tag. you can do the same by hit component:

just add the tag to the actors or components you want to trigger the branch.

for actors look in properies actor tags:

image

same for components:

image

P.D.- you can merge the hit condition and the tag condition into a single one with AND

1 Like

Thank you so much! worked perfectly!

1 Like

Glad to help!

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