Translate, Rotate objects with mouse


#1

Hi community,

I would like to know if it is possible to translate and rotate objects using the mouse (not the camera XD).
And if possible what would be the functions used?

Cheers all!


#2

Of course this is possible. Few functions:
getMouseX()
getMouseY()
setHpr()
setPos()

Relative/Absolute can be changed with programming, changing between function has to be programmed, changing between objects has to be programmed. If you want to use the mouse for that, this is useful: https://www.panda3d.org/manual/?title=Clicking_on_3D_Objects


#3

Let me note that the same page also shows the specifics of how one gets the mouse-position (including checking whether the mouse-position is available).


#4

You may also want to check out this topic: Rotating a node
It has some code showing how one could make a rotation widget and some fancy math helpful in relative rotations.