Download

Line trace for pickup item

Hello,

I know this might be a basic question but hear me out. So I have an interact interface and the player can pickup an item already. But I am going to have items that can be picked up from the ground, table or tree. What kind of line trace can I do in order for when I press E, to get the height location of an item, to play the correct animation depending on where the item is?

Trace by channel should work. then from trace break hit result, compare impact location to character location Z value, and if it is equal to character Z its right in front, if it is above a certain z value it is above, or if it s under a certain z value it is looking down.

you can even do a range of floats. in front could be between 50 & -50. above 50 is looking up, below -50 it is looking down. i could give ti a try and probably give a visual if you need. if not this could get you looking in the right direction maybe. Good Luck!

@MindfieldsTech before I noticed your reply I switched it from a line trace to a collision overlap. I’m using a third person perspective and the line trace was having issues with hitting the item in the tree and on the ground. It was just aiming straight from the character hitting the item on the table. Would this work using an overlap to determine which animation to use for the 3 heights. Or should I use a line trace instead and get an all actors of class “item_BP” or has tag “item”?