Welcome to the forums @antares!
Its a little bit old, probably not the best way to handle it, and has some quirks, but I have a tutorial on RandomMomentania for making run-time gizmos for manipulating objects that may be useful (at least as a reference?)
Can you share what is not working and maybe the setup you are using? For example, one thing that could be an issue is that the camera is not aligned exactly with zero rotation relative to the cube, as I believe the code above will only work if the camera has no rotation relative to the cube.
If you have a reference to the camera node, then you may be able to replace Vector3.UP
with $camera.global_transform.basis.y.normalized()
and should make it relative to the camera view. You may also want to use rotate
instead of rotate_object_local
but I’m not sure right off.
I’d need to experiment to have a better idea of why the code is not working and what needs to be changed.