Get the new relative position of an object that draws to a to jit.gl.node
hi,
let say you create a simple gridshape. You tell this gridshape to draw to a jit.gl.node. Now you change position of this node in the 3d space.
Is there a way to retrieve easaly the new relative position of that gridshape, therefore without to make a calculation of the new coordinates
(i mean is there an argument or an already packaged feature that does it ?)
In short this is what i want to achieve :
let say i have 3 gridshape spheres.
- At first they draw to jit.world. I can retrieve coordinates in the world context.
- Now i d like to group these spheres so i can apply transformation to a groupe of objects, and i believe the best way is to create a gl.node (call "group1), and tell these spheres to draw to this node.
- Now i change position, or rotate "group1" - i would like to be able to retrieve the new position of each of these spheres in the world context.
Any idea of the best way to do this?
example patch :
thx!
I don't remember all details but there are messages "getworldpos" and " getworldquat" with jit.anim.node.
https://cycling74.com/forums/coordinate-systems-of-jit-gl-handle-jit-world-and-jit-gl-camera
https://cycling74.com/forums/jit-anim-node-hierarchy
https://cycling74.com/forums/allocentric-viewer-to-position-an-egocentric-camera
yep you need to use jit.anim.node. simply "bind" a jit.anim.node to the jit.gl object you'd like to query (either via patchcord from anim.node to jit.gl object, or via jit.gl @anim attribute set to the name of the anim.node object)
excellent both! thx!
i was confusing again between gl.node and anim.node ;)
it is tricky a bit :) so it's better not bind to any jit.gl.node and start to move this node (as a group) if you want to be able to retrieve the position of initial gl object. good to know definitely
ok just tested it. its not exactly what i want to do.
I d like to gather object in a group (like a gl.node) and be able to retrieve position of each the initial objects if you move the node itself (as a group).
any idea?
https://cycling74.com/forums/jit-anim-node-hierarchy
ok thx! It was really not obvious for me because you have to think an whole hierarchy based on anim.node and use that getworldpos on a lower anim.node that represents the intial position of the mesh or gridshape.
got it now :) - i thought that jit.gl.node would have been the straight forward and ideal object to manage this.
a simple summary patch :
if you prefer to use jit.gl.node then go for it. the behavior in this case is identical: