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.

Input

Set Rotation Variable

Set Held Object Rotation

-Thanks

Sadly I’m having the same problem. Followed this tutorial but I don’t think they solved it either, they simply never showed it not working: Unreal Engine 4 - Zoom & Rotate Object - YouTube

For me when I input stuff on the Y axis the object always spins the same direction, according to the worlds Y axis, no matter if I use world/relative/actor rotation.

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!

1 Like

This is the tutorial I based my function on btw: Unreal Engine 4 - Item Inspection (Part 1) - YouTube

Just found this very useful :slight_smile:

It wasn’t obvious.