I am trying to make a picked up object rotate on a certain axis no matter what its local rotation is.
For those who played it:
It should be like it is in Gone Home.
For those who didn’t:
I’m making a system where you can pick up an item and then rotate it. I can make the item rotate by moving the mouse, but I want it so that when the mouse is moved forward, the object always rotates around a temporary ‘global’ axis, instead of its current local axis.
Have you tried using the Set World Rotation node? If not, what type of set up are you using to do your rotation? Anything that mentions Local rotation is going to give you a result akin to my 2nd picture. I just created a small blueprint for that chair to rotate overtime using a timeline and the Set World Rotation node and it spins along the global Z axis like in the first picture.
Add the mouse Y to the Y and X to the Z of the rotation
Make Rotator
Get Root Component (of the selected actor)
Set World Rotation of the Root Component to the Make Rotation
I changed it to:
Make Rotator with X:0, Y:Mouse Y, Z:Mouse X
Get Actor Rotation
Combine Rotators
Set World Rotation of actor’s Root Component to the Combine Rotators
This fixed rotation being stuck at 0 degrees, and rotation works a lot better overall.
The problem now is that I need a custom ‘Y’ axis, to make the object rotate around an axis parallel to the player’s Right Vector.
Any idea how to do this?
I eventually fixed the problem by creating a component in the Character’s actor and attaching the picked up object to this component. Then I set this object’s relative rotation for the Mouse Y (Y axis), and the world rotation for the Mouse X (Z axis). Rotation works perfectly now
I’m trying to achieve the same thing you did right now.
Could you provide a screenshot of your blueprint? I think I don’t fully understand how you did the rotation.
I’m setting the world rotation for the Z- axis with Mouse X, too. This works perfectly.
But I don’t get the Y-axis rotation to work.