Back to Tools and Commands

Node Move

The nodeMove command handles object movement inside the scene. To activate this command, call:

api.commands.activateCommand('nodeMove')

options

The default options are:

options: {
  displayGizmo: true,
  mode: 'free',

  //default plane is the x-z plane
  plane: {
    normal: { x: 0, y: 1, z: 0 }, //normal direction
    constant: 0, //distance to original
  },
  surfaceNodeIds: [],
  onChange: undefined,
  onEnd: undefined,
},

displayGizmo

Control whether or not to display the widget around the selected node. The widget can be used to move the object along the x, y and z-axis.

mode

There are three different modes: free, plane and surface. Corresponding to move node freely in the scene, move the node along a given plane, and move node on given objects' surface respectively.

plane

An object representing a plane and only used when setting the mode to plane. See Move Node On Plane.

surfaceNodeIds

An array of node ids, used only when setting the mode to surface. See Move Node On Object.

onChange

A custom function that will be called every single frame when an object is moving. See Attach Object.

onEnd

A custom function will be called at the end of the object movement.

var opts = {
  onEnd: function(ev) {
    console.log('move end at', ev.clientX, ev.clientY);
  },
};
setCommandOptions('nodeMove',opts);