Back to Demos

This demo shows how you can transform vertices of an object by adding operator.

Selected Vertices

Use single number for one vertex (ex. 1)
Two numbers with minus sign in between for a range of vertices (ex. 0-3)
Make sure they are separated by a comma

Translation Along Y demo resources:

Visit Base Scene

var sceneId = 'bed4613e-665d-4097-8944-2cf95cf99810';
var api = claraplayer('player');
var meshName = 'Box';
var selectVertices = document.getElementById('selectVertices');
var moveVertices = document.getElementById('moveVertices');
var index = 0;
var meshId;
var operatorIndex;

  selectVertices.oninput = inputHandler;
  moveVertices.oninput = moveHandler;
  meshId = api.scene.find({name:meshName});

function moveHandler(){
  var translationPath = api.scene.find({name:meshName, plug:'PolyMesh', properties:{name:operatorIndex}, property:'translation'});
  var translation = api.scene.get(translationPath);
  translation.y = moveVertices.valueAsNumber;      

function inputHandler(){
  operatorIndex = 'operator'+index;
  moveVertices.value = 0;
  var selectedVertices = selectVertices.value;
  api.scene.addOperator(meshId, 'PolyMesh', 'TransformVertices', {}, operatorIndex);
  api.scene.set({name:meshName, plug:'PolyMesh', properties:{name:operatorIndex}, property:'vertexIndices'}, selectedVertices);