How to route rotatexyz from jit.glhandle

Mauro Trotta's icon

Hi all,

For a device I am developing I need to route the rotatexyz data so the user can have the option of moving a text display with jit.gl.text clicking and dragging with the mouse, or by typing the desired coordinates in a live.numbox. I manage to do it with the position of the jit.glhandle, but can't figure out with the rotatexyz attribute. I can send messages to the handle with a $1 and change each coordinate independently but when typing in x and then in y, x becomes 0 again.

Max Patch
Copy patch and select New From Clipboard in Max.

TFL's icon

You can just copy what you did for position: remove your rotatexyz messages with $1, keep the [prepend rotatexyz] lane, and replace [pack] with [pak].

Mauro Trotta's icon

Thanks, that fix a part. But I also need the coordinates to be displayed in the live.numbox when the user rotate the text by clicking and dragging with the mouse. I tried to use route rotatexyz but it doesn't give any output. Also there is no getrotate message for the jit.gl.handle.

mike's icon

hello Mauro Trotta,

perhaps getting the rotatexyz value of the [jit.gl.text] object is an option for you.
This can be achieved with the [getattr] object.

here is a small demo

mike

Max Patch
Copy patch and select New From Clipboard in Max.

TFL's icon

There are multiple ways to express rotations, and Max uses different words to differentiate them, each having its own benefits:

  • rotatexyz: what you want, rotation in degrees along each axis

  • rotate: angle of rotation and (x y z) vector about which the rotation is performed

  • quaternion

You want rotatexyz, but [jit.gl.handle] outputs rotate messages. You can easily see that by connecting a [print] to it or just a messages right inlet.

You can [route rotate] messages from [jit.gl.handle] main output, and from that trigger getrotatexyz sent back to it. Then you'll get the rotatexyz values from the objects right outlet.

Also there is no getrotate message for the jit.gl.handle

There is one, but it gives you the angle-axis rotation (not x y z), and get messages give an output from right outlet, not left.