Hello! I am working on a project and I would like the player to be able to pick up this object and it show up in front of them. This object that I’d like to do this to is a lighter and I want the player to be able to pick it up and flick the flame on and off. How would I achieve this? I already have a script that says when the player enters a trigger and presses a button, the object does something. I have it set to destroy object temporarily to give the illusion that the player picked it up. Now I actually want to be able to interact with this object with it in front of the character’s body. Any ideas on how to do this are greatly appreciated. Thanks!
If theres a player model you could do it like this:
Mesh is the Player Mesh, Penetrator the picked up item
Then make a reference to the spawned item (or just replace the spawn actor with your overlapping stuff) so you can execute stuff on it, like flame on and off.
Please note that you have to create a socket
Well. I am not using a mesh and I only want the object to follow the player’s camera and I need the player to be able to interact with the object only after they’ve picked it up. Thanks for the help.
Are you using a camera component?
If so, you could attach the lighter directly to that, offset so that it appear in front of the final camera view.
Similarly, you could attach it to your pawn/character, offset based on the eye height and need to be in front of the final camera view.
Can’t really suggest anymore without knowing your setup, inventory requirements etc.
Thanks! What you suggested worked very well, but the lighter is at 0,0,0 in relation to the player so I can’t see it. Here is the code I used
I’m not sure how I add the offset for there is no Vector input. Am I using the wrong node? If so, which do I use? If I’m not, What would I do to add the offset to this object. Thanks for your help!
The “Attach Location Type” does this. At the moment it is set to “Keep Relative Offset”. So it will just keep the offset that was there at the time you Attached the actor.
Look into the drop down menu and take the one fitting your needs. I haven’t follow the whole discussion but maybe “Snap to Target” would be helpful for you.
Okay. I tried using the “Snap to Target” option on the node. I would like the object to be in front of the camera but the object appears to be right below it. When I look down I see the top of the object. Is there a way to make the offset of this object a vector that I could customize. If not, I was thinking that I could somehow have an object that acts like a socket on a skeletal mesh and I could have the script attach the object to this socket. Like I have an invisible sphere in the position where I want the object and I can just attach the object to there. I have no idea if this would work. I’m just thinking aloud. Thanks for all of your help.
Try using a SetRelativeXXX or AddRelativeXXX nodes.
If you do this before the Attach Actor to Actor node, just make sure you use keep relative offset.
Sweet example! Lol are you remaking Postal 3 for Vince? I see a job at RWS in your future…
Quality naming conventions as well! Life’s too short to not name things dfgdfg_Skelton.