Lock mesh pivot to Camera

Hello! I’m trying to pick up an object with a button press. This happens just fine. However, I can’t seem to get the object to turn with me. It turns with the camera, but the objects local rotation doesn’t turn with the camera. Is there a way to bind the pivot of the object to the camera’s direction as long as the object is being held?

I’ve been struggling with this and trying to figure out if there is a way to unlock the ‘locked’ rotation setting while holding it, but to no avail!


I believe that you’re trying the wrong thing mate. This question can be understood in two different ways; I’ll explain both of them.

If you’re trying to Rotate the Object when you’re holding it, in your Programming, disable Add Pitch/Yaw when Holding it and add the Input turn Axis to the Local rotation of the object instead.
If you’re trying for the object to follow the character’s general rotation, you can simply get ActorRotation.Yaw and then use that to set the rotation of the Yaw component of the object that you’re holding.

I’m not sure where to put the get ActorRotation node. I’m including an image of what I’m trying to accomplish. Thank you so much!

Get the cameras rotation on the start of grab and save to variable. Compare that against the rotation during the grab. The difference is the amount you need to rotate the grabbed object.

I’m using the first-person camera from the template. When I run it, it says:

Blueprint Runtime Error: Accessed None trying to read property Camera from function: ‘ExecuteUbergraph_FirstPersonCharacter’ from node: SetActorRotation in graph: EventGraph in object: FirstPersonCharacter with description: Accessed None trying to read property Camera

I’m confused since I promoted the target of the first person blueprint to a variable.

not sure what going on in your bp, but my first thought is that get actor rotation expects an actor as the target while your camera is not an actor but a component.

if you add this code to your fp character you will be able to pick up the blue cubes from the vr template. the blue cubes can then be replaced with whatever static mesh you want. it won’t be using simulating physic with this method though.

edit: you’ll want to add the vr template to your project first so that you get the interface. you can do that via the big green ‘add new’ button then ‘add feature or content pack’

Wouldn’t it be easier to use the AttachTo node and just tell it to snap the rotation to the parent?