Rotating an object relative to the First Person Camera
So I'm trying to set up this prototype and I'm just having a doosie of a time getting this rotating mechanic working. The idea is that I want to be able to pick up a physics object using a physics handle (works just fine), then the player should be able to rotate the object while holding it. I'm pulling the player's transform and composing it with a transform built from an "Object added rotation" rotator. Basically the idea is that when the player adds scrolls the mouse wheel it adds or subtracts from the pitch (depending on which way the wheel is scrolled, E and Q control the yaw, and R and F control the roll. This data is all stored in the "object added rotation" variable.
The problem is I want the pitch yaw and roll to always be relative to the camera. Scrolling the mouse wheel forward should always tumble the held object forward, away from the camera. The F key should always rotate the object clockwise facing he camera. However, Even when the setting the objects world rotation, pitch and roll get switched depending on the position of the yaw. Could someone give this a look and see where I'm going wrong? I hope my explanation was clear.
Set Rotation Variable
Set Held Object Rotation
asked Jan 01 '17 at 09:50 PM in Blueprint Scripting
I solved my issue by getting the right vector from the Z axis on the player camera and then using that and the input from my mouse to make a rotator and combine it with the current rotation. Worked for my setup, let me know what happens with yours!
answered Mar 22 '17 at 10:19 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here