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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -