Adding Rotation to a First Person Camera?

Hey there, I’m sure there is an easy solution for this, but I haven’t been able to find one and I’ve been stuck on this for the last few days, I’m trying to create a player-controlled pawn that moves and rotates along a spline.

The player should be able to look around freely in first person, but forward should always be the front of the pawn, very similar to a roller coaster… This is for Oculus Rift.

This is what happens when I take control of the pawn and move it along the spline:

30066-pawnrotation_2.gif

I can look around freely, but the rotation of the camera isn’t affected by the rotation of the pawn at all. Whenever I uncheck the “use pawn control rotation” on the camera component, that blocks all rotation inputs.

This is my Blueprint set up:

Any help would be fantastic, I’ve been stuck on this for ages and can’t find a solution!

are you already tried to parenting your camera to static mesh, and try again (play with use control rotation, etc)???

I don’t really know if this would work in practice, but maybe something like:

  • Create a Rotator Variable
  • On Begin Play, get the world rotation of the mesh your player is sitting in and save it into the variable
  • On Tick, get the world rotation of the mesh your player it sitting in, subtract it from the saved variable, and apply the result as a rotation offset to your pawn camera. Update the variable again with the current rotation.

Technically that should add the mesh’s rotation to your camera every frame but I don’t really have the setup to try this right now so I can’t guarantee anything :stuck_out_tongue:

Edit: or mirsabayu’s suggestion would be a lot simpler if it works.

Yep I’ve tried this, but it seems like whenever I disable “use pawn control rotation” all rotation inputs are ignored.

It seems like the camera does not inherit the rotation from the parent, no matter what it is.

That’s a good idea… I’ll try it out and get back to you.

EDIT:

So I just gave this a try, but no luck… It doesn’t look like you can add relative rotation to a camera, it doesn’t affect the view at all. You can set the Control Rotation of the player controller, but that overrides all inputs…

Almost need a way to calculate the inputs of the player, and turn them into a rotator, then add the current rotation of the pawn and set that as the control rotation every tick. But I’m unsure of how to do that, or even if it’s a good idea…

Hey man,

Thanks for your response, I should have come back and updated this thread! I found the solution by disabling “Use Pawn Control Rotation” on the camera inside my “Pod” pawn. And then taking the control rotation of the player controller, and applying that to the relative location of the camera inside the “Pod” pawn.

Hi, I think I know what you need!

You should get the rotation at each point along the spline and instead of setting your control rotation, use Add Yaw Input for left/right.
Add Pitch input for up/down.

Something like this:

Thank you for the swift reply!
Since you’re using Oculus, I think that simply checking Use HMD Orientation in your camera manager could work too:

It was a while ago now, but I believe I did have that option checked, and still wasn’t getting any inherited rotation from the pawn. The HMD just always overwrote the rotation.

Was a couple of days of slamming my head against the wall before finding out that trick of applying the control rotation to the relative rotation of the camera.

Just wondering, what do you have the Set Relative Location node attached to? Event tick? Input action?

Haha glad this helped someone out, I was also stuck on this one for a little bit, seems so obvious now though!

OMG Scty, you saved my life. I’ve been pulling my hair for the past 2 days on this one. I did exactly what you recommended, and it worked.

ALL HAIL THE MIGHT SCTY /CRY

Seriously I can’t believe how simple it was, I had this giant Bp that ended not doing anything at all after so much work, then this came along.

Thanks again, glad you came back to post your findings.