javascript - How can I set the axis for a line to the center in three.js -


i made cube using vector3, , want able set axis center of cube. think axis set (0, 0, 0). want axis in middle can rotate cube around center.

here jsfiddle: http://jsfiddle.net/n6o7cq4l/1/

var square = new three.geometry();    square.vertices.push(new three.vector3(0, 0, 0));  square.vertices.push(new three.vector3(0, 5, 0));  square.vertices.push(new three.vector3(-5, 5, 0));  square.vertices.push(new three.vector3(-5, 0, 0));  square.vertices.push(new three.vector3(0, 0, 0));    square.vertices.push(new three.vector3(0, 0, -5));  square.vertices.push(new three.vector3(0, 5, -5));  square.vertices.push(new three.vector3(0, 5, 0));  square.vertices.push(new three.vector3(0, 5, -5));    square.vertices.push(new three.vector3(0, 5, -5));  square.vertices.push(new three.vector3(-5, 5, -5));  square.vertices.push(new three.vector3(-5, 0, -5));  square.vertices.push(new three.vector3(0, 0, -5));  square.vertices.push(new three.vector3(-5, 0, -5));    square.vertices.push(new three.vector3(-5, 0, 0));  square.vertices.push(new three.vector3(-5, 5, 0));  square.vertices.push(new three.vector3(-5, 5, -5));    var line = new three.line(square, new three.linebasicmaterial({ color: 0xffffff, opacity: 0.5 }));  scene.add(line);    var cubeaxis = new three.axishelper(20);  scene.add(cubeaxis);
<script src="http://threejs.org/build/three.min.js"></script>  <script src="http://threejs.org/examples/js/controls/orbitcontrols.js"></script>


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -