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:
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!
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
Edit: or mirsabayu’s suggestion would be a lot simpler if it works.
That’s a good idea… I’ll try it out and get back to you.
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…
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.