Adding nodes and drag them dynamically on player

I am trying to access the nodes from the player in order to drag them as well as adding other nodes to the scene dynamically.
Taking a look at the API, I have access to the SceneGraph where I can access the nodes with all their properties as follows:

How can I manipulate these nodes to actually move them around and adding them to the scene?
I have been able to add nodes using the function Player.scene.addNote, yet the node is not being updated on the scene even though I can see it being added to the nodes in the console where I get the nodes from the scene when I do a console log.
Am I missing something here after adding the node to the scene?
I am not sure if that is the right way to approach so I am looking for advice.

I have been reading thru the ThreeJS library and have been trying to implement this control but I am not sure if which objects to pass as the nodes that I get from the sceneGraph do not seem to work. It asks for 3dObjects, not nodes.

Ps: I looked at the drag and drop post on the forum but did not get much information from there.
Thanks in advance.

Hi Claudio, this is a custom development question and requires a little investigation from me. I’m gathering some resources and will have an answer to you as soon as I can. Stay tuned, thanks!

Hi Claudio, we implemented this in our drag handler using the synchronous call on the scene: scene.set(query, values) that is not in the documentation.

An example of this is: scene.set({ id: nodeId, plug: "Transform", property: "translation" }, { x: 1, y: 2, z: 3 });

We also use a property of “scale” and “rotation”. I think “shear” may be available as well but we don’t use that. One thing to note is that the value you set is not a delta, but rather the final position, so if you have a node that’s at (1, 1, 1) and apply a translation of (2, 3, 4) the final position will be (2, 3, 4), not (3, 4, 5).

Additionally, you could just set the translation/scale/rotation during the initial addNode call by adding in the transform plug:
const transformPlug = {
name: “Transform”,
type: “Transform”,
translation: { x, y, z },
rotation: { x, y, z },
scale: { x, y, z }
};
scene.addNode({ name, type, plugs: { Transform: [ transformPlug ] } }, parentId);

Hope this helps,
mike

2 Likes

Hi Claudio, someone from my team will be (or has been) in touch with additional support and guidance so I will close this thread. Please DM me or open another topic if I can help further.