kovacsv / JSModeler

A JavaScript framework to create and visualize 3D models.
MIT License
648 stars 124 forks source link

Generate axis grid #8

Closed Daubsy closed 9 years ago

Daubsy commented 9 years ago

Im trying to generate grid lines for the x, y, and z axis. I have not found an easy way to accomplish this for a three.js viewer. Any suggestions? Thanks!

kovacsv commented 9 years ago

Viewer does not support currently to add lines, but you can add them directly to three.js scene like this:

var geometry = new THREE.Geometry ();
geometry.vertices.push (new THREE.Vector3 (0.0, 0.0, 0.0));
geometry.vertices.push (new THREE.Vector3 (-2.0, 0.0, 0.0));
var material = new THREE.LineBasicMaterial ({color: 0xff0000});
var line = new THREE.Line (geometry, material);
viewer.scene.add (line);

See this fiddle for example: http://jsfiddle.net/0axfbvL9/2/

Daubsy commented 9 years ago

I see. Thanks for the help!