Im puzzling my mind on rather simple task. Rotating actor relative to camera position (camera space). I feel like I know the basics and how it should work, but it just doesnt. Rotators are very confusing.
I wish I could just provide axis to rotate around.
Please check out my sample project or screenshot below. I want to rotate this cube in screen space. No matter from which direction I look at it, it will rotate along camera’s x axis located in the middle of cube. Hope it make sense.
You can get forward, right and up vector of the camera. Then you can rotate vector around axis, for eg. forward vector of cube rotate around up vector of camera. Result will be some vector that is length 1. Then you can find rotation by applying this to find look at rotation, from [0,0,0] to your rotated vector value.
You can also find that rotation with other nodes, but i think find look at rotation will be best here. Watch for near pole artifacts.
Nawrot, thanks for reply. Unfortunately, I couldnt get it working. I dont get how rotators work. Its a roll, pitch, yaw, but in a local space of rotated object right ? Then how can I convert world space axes to local space rotator. When I create MakeRotationFromAxes with [1,0,0][0,1,0][0,0,1] values, then object wont rotate at all(just for test).
Again, here is what Im after.
This setup gave me cube rotating in many directions, nothing consistent.
This whole vector math on last picture is bogus.
First you are getting vector from cube to camera.
Then you zero X and Y, leaving only Z.
Rotator from axis and Angle normalizes that vector.
So if you plugged only [0,0,1] into rotator from axis you would have same result.