Attach Object to Player with offset

Hello! I have an object that I would like the player to pick up and have it float in front of his camera. Not like a physics gun kind of thing. I just want the object to follow the player’s camera or just the rotation of the player. I’ve concluded that the attach actor to actor function is the answer but I’m not entirely sure what to do other than that. When I check “Snap to Target” on the node. The object attaches to the player properly but appears inside the character instead of in front. My character is not a skeletal mesh so I cannot attach the object to any socket. Any idea on how to do this would be greatly appreciated. Thanks.

You could just set the floating object’s location to the forward vector + your offset.

Do I have offset+forward vector and then an add actor relative location node?

I’m not sure, haven’t done something like this before, there is node to get a certain location that is however many units in front of any location.

I could use Snap To Target on the Attach Actor to Actor node and then add the forward vector + Offset to the targets location. I’ll try to test it as soon as I get the chance.

Yes but adding the offset wont work, because the offset will be different depending on what direction the player is facing, what I mean was the there is a node that will get the character’s rotation and the offset and convert it, then you can add the return node to your forward vector. If my computer stops having troubles, I will try and find what node that is and post back here.

Hello,
You can create an empty component (empty static mesh) attached to camera and set at right location. When nothing, you set it empty, when you have an item, you fill it with the static mesh. If location is not the same for all items, you can create an array of transforms (locations rotations) for each type of item wield.

Okay. So I could make a Charcter BP variable and make it public and set that variable to my character controller script. I could then from my object BP access that empty and move the object to that empty. Okay! That makes sense. Thanks!

Got it!

Thanks a ton! :slight_smile:

1 Like

I know this is old and I’m reviving a solved post, but do you know the name of this node?

I have two camera aligned text renders attached to an object, but I would like to offset one text render to right. The problem is when you rotate the camera around to the other side the text ends up on the left.