Back to Demos

This demo shows how you can move nodes on given objects.

Clara.io demo resources:

Visit Base Scene


var sceneId = '5c146c42-6b2d-47ee-9275-c929fa431439';
var api = claraplayer('player');

api.player.showTool('nodeMove');
api.player.removeTool('select');
var hl = api.selection.setHighlighting(true);

api.sceneIO.fetchAndUse(sceneId).then(function() {
  var baseObjectIds = api.scene.filter({ name: 'torus' });
  var moveObjectId = api.scene.find({ type: 'PolyMesh', name: 'sphere' });

  var opts = {
    displayGizmo: false,
    mode: 'surface',
    surfaceNodeIds: baseObjectIds,
  };
  api.commands.setCommandOptions('nodeMove', opts);
  api.selection.selectNode(moveObjectId);
  hl.selectionSet.add(moveObjectId);
  api.commands.activateCommand('nodeMove');

  document
    .getElementById('baseScene')
    .setAttribute('href', 'https://clara.io/view/' + sceneId);
});