Resizing Nodes

@CarterWS and I have found that when new nodes are added to an object they are very large and appear in the same location. Is there any way to resize the node when added within the code, rather than having to change its size within the toolbox app? We noticed there is a moveNode() function that can take scale as a parameter, is there any way that can be used to resize the nodes?

Hi @alinashah when you generate a target for an object, you need to use the actual meter size of your physical target to define the size of the virtual target. If the target is small and only a couple cm, you still need to use meters. The size of the nodes should feel comfortable, once the sizes match.
You are correct moveNode() can reposition the node and scale will change its size.

Yes, if you don’t specify the size of the target exactly, the AR device will think it is an incorrect distance away from your content, so the sizes of the nodes get rendered incorrectly. For instant image targets, you can adjust the target size on the web interface by clicking “Edit Target” > “Set Target Size”. For all other target types (e.g. the ones created using the portal), you need to specify the size when you generate the target.

There is also an optional parameter you can use when you add a node to set its initial position and scale, if you want some nodes to be bigger or smaller than others:

When adding a node from a hardware interface:

server.addNode(objectName, toolName, nodeName, 'node', {x: 100, y: 50, scale: 0.5});

When adding a node from a tool:

spatialInterface.initNode(nodeName, 'node', 100, 50, 0.5); // different parameter format

So we were trying to use moveNode() in a couple of different ways as shown below, however instead of seeing a node of a different size at a different position on the screen, there was a black line across the toolbox or the node does not appear. How should we be using the function to move the nodes properly?

server.moveNode(objectName, TOOL_NAME, “moveTest”, 0, 0, 1, [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1], “object”);

server.moveNode(objectName, TOOL_NAME, “motorA”, 1, 1, 0.5, matrix, “object”);
//where matrix is a 2D array (identity matrix)

Please double check if your object target has exactly the size of the physical object target.

moveNode(object, tool, node, x, y, scale, matrix, loyalty)

x and y move the node along the target origin plane.
scale resizes the node
matrix set it to null if you’re not interested in a matrix transform.
loyalty is under developed. Eventually it will tell to what object your node should stick. Currently if you set it to true, it will stick to the ground plane. So in your case set it to false.

server.moveNode(objectName, TOOL_NAME, “motorA”, 0, 0, 0.5, null, false);
This will set your node to the target origin with half the scale.