harrykeen18 / dxf-three.js-JSON_translator

dxf to usable webgl translator
7 stars 4 forks source link

automatically positioning objects #2

Open harrykeen18 opened 8 years ago

harrykeen18 commented 8 years ago

vector3 is great for positioning objects based on xyz co-ordinates. Meshs constructed with Moveto and Lineto take only xy co-ordinates and then require moving/rotating into the correct position. @theo-armour Is there a way to use vector3 to build meshs to avoid tricky moving and rotating?

theo-armour commented 8 years ago

@harrykeen18

I use these two tricks:

    geometry.applyMatrix( new THREE.Matrix4().makeRotationX( -0.5 * Math.PI ) );
    geometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, 0, 0 ) );

These both allow lines and shapes to be moved about before they become meshes.

Also I use

        geometry1.merge( geometry2 )

In order to bundle things before creating meshes

If you search the code of Three.js examples you will find examples of their usage.

Or if you need more specific examples, just holler.