I’ve been implementing a blueprint transform gizmo to translate and rotate actors at runtime in my build game. I have the translation working correctly, but I’'m struggling with the rotation aspect. There’s not a huge amount of info I could find online about how to do this. I’ll post a couple of links to what I have found. From what I understand, the best way to do this is using quaternions, but my understanding of them is lacking a bit.
I have the Blueprint quaternion library plugin, so have access to a lot of quaternion functions if need be. Currently I’m creating a plane with a normal equal to the axis of rotation, and doing a line-plane intersection from the mouse position to find an intersection point on that plane. I just don’t know how to translate the mouse movement to a rotation.
So. The way I did this recently is for a real time strategy camera, but the concept is nearly identical on objects.
Create the mouse axis input and use it to determine if the mouse is moving and which direction it is headed on (based on axis).
You can then create a positional vector and turn it along to the object you need to rotate.
or you can just change the object’s local rotation by adding 1 every time the event is called.
You do need to isolate the initial node to keep it from constantly running.
just do if axis!=0 > true > your local rotation logic.
Rotating all 3 axis with only 2 movement axis won’t exactly be possible.
I would actually make an axis informed decision when dealing with x or y.
If camera and object have the same X I would affect the Y - and viceversa…
Z, the yaw, should probably always rotate with left to right…