Location plus rotation to get line trace start and end

I’m probably being really stupid but for the life of me i cant figure this out and i know its simple.

I need to get the line trace on the corner of my box that is physical, ive used location vectors to work out the corner if the box hasnt rotated how do i add the rotation so the line trace moves with and stays on the corner of the box?

26698-linetraceingame.jpg

Can you place a socket on your static mesh, then ask for the socket location

Thank you so much, just before you posted this i put box components on the corners but sockets would work better thank you.

You don’t say how exactly you want the trace to extend out from the box, but you probably want to multiply your offset vector by the box’s rotation converted to a vector before you add it to the start location. That way the offset vector ‘turns’ along with the object. Also people usually use the forward vector for line traces not the up vector, unless you’re trying to see what’s above you and not in front of you.

Finally, here’s a good tutorial on youtube that shows you what I mean by this extra multiplication: Unreal Engine 4 Vector Tutorial 3 - Working with vectors - YouTube

Good luck!

1 Like