Automatic initial rotation of Camera component with use controller view rotation enabled - Possessing Pawn
I have a Pawn blueprint that I Possess on Begin Play of my level, in this blueprint I have 2 main components a Mesh (my vehicle) and a Camera (the in cockpit view). I want the player to have free control over the camera so I have used InputAxis Turn to Add Controller Yaw Input and InputAxis Lookup to Add Controller Pitch Input. With the Camera component I have enabled the setting Use Controller View Rotation. This has successfully enabled me to allow the player to look around inside the vehicle, However I have one big problem - the initial camera rotation is always 90 degrees to the left (Yaw). I have the camera correctly positioned inside my blueprint but that rotation is ignored on Begin Play.
Is there some way to stop whatever the override is and have the initial camera rotation pointing in my desired direction when the player takes control so they start Possessing the pawn looking forward? And importantly can someone tell me what is causing this?
I have tried setting the rotation in the blueprint graph manually but I cant seem to find a method that works. Previous questions here say to disable Use Controller View Rotation but that defeats the purpose of my project as that stops the player looking around.
asked May 04 '14 at 02:41 PM in Blueprint Scripting
After many days spent on this problem I tried a solution, a solution that I thought couldn't possibly work, turns out simple solutions tend to work.
If you have a camera that is player controlled inside a pawn blueprint, you cannot rotate the camera component. Whatever rotation you try to set, with rotating the component or rotating it via the blueprint graph, it will always align to its default rotation, 0,0,0. (unfortunately this is not clear when using the editor)
You must therefore rotate all your meshes around the camera to fit the rotation you want and rotate the blueprint.
So in my case I had originally set my camera component to 0,0,-90 and my mesh had a rotation of 0,0,0. I had to add a box component so my mesh no longer would be the Root of my blueprint components so I could then reset my camera to 0 and instead rotate my mesh and align to the camera.
I hope this information is useful to some people, it caused me quite the headache.
answered May 06 '14 at 05:49 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here