body = new THREE.Object3D();
var bodyLength = 60;
createRobotBody( body, bodyLength, robotBodyMaterial );
arm.position.y = bodyLength;
body.add( arm );
scene.add( body );
handRight = new THREE.Object3D();
createRobotGrabber( handRight, handLength, robotHandRightMaterial );
handRight.position.y = faLength;
forearm.add( handRight );
handRight.rotation.z = effectController.hz * Math.PI/180;
handRight.position.z = -effectController.htz;
var flower = new THREE.Object3D();
for (var i = 0; i < 24; i++ )
{
var cylinder = new THREE.Mesh( cylGeom, petalMaterial );
cylinder.position.y = petalLength / 2;
var petal = new THREE.Object3D();
petal.add( cylinder );
petal.rotation.z = 90 * Math.PI/180;
petal.rotation.y = 15*i * Math.PI/180;
petal.position.y = flowerHeight;
flower.add( petal );
}
var maxCorner = new THREE.Vector3( 1, 1, 1);
var minCorner = new THREE.Vector3( -1, -1, -1 );
var cylAxis = new THREE.Vector3();
cylAxis.subVectors( maxCorner, minCorner );
var cylLength = cylAxis.length();
cylAxis.normalize();
var theta = Math.acos(
cylAxis.dot( new THREE.Vector3(0,1,0)));
var cylinder = new THREE.Mesh(
new THREE.CylinderGeometry(0.2, 0.2, cylLength, 32), cylinderMaterial );
var rotationAxis = new THREE.Vector3(1,0,-1);
rotationAxis.normalize();
cylinder.matrixAutoUpdate = false;
cylinder.matrix.makeRotationAxis( rotationAxis, theta);
var cylinder = new THREE.Mesh(
new THREE.CylinderGeometry(0.2, 0.2, cylLength, 32), cylinderMaterial );
for ( var i = 0; i < 4; i++ )
{
var cylinder = new THREE.Mesh( cylinderGeo, cylinderMaterial );
var x = (i < 2) ? -1: 1;
var z = (i % 2) ? -1: 1;
var rotationAxis = new THREE.Vector3(x,0,z);
rotationAxis.normalize();
cylinder.matrixAutoUpdate = false;
cylinder.matrix.makeRotationAxis( rotationAxis, theta );
scene.add( cylinder );
}
var cylAxis = new THREE.Vector3();
cylAxis.subVectors( top, bottom );
var length = cylAxis.length();
var center = new THREE.Vector3();
center.addVectors( top, bottom );
center.divideScalar( 2.0 );
var capsule = new THREE.Object3D();
capsule.add( cyl );
if(!openTop || !openBottom ){
var sphGeom = new THREE.SphereGeometry(radius, segmentsWidth, segmentsWidth/2);
if ( !openTop){
var sphTop = new THREE.MESH( sphGeom, material);
sphTop.position.set( top.x, top.y, top.z );
capsule.add( sphTop );
}
if ( !openBottom ){
var sphBottom = new THREE.Mesh( sphGeom, material );
sphBottom.position.set( bottom.x, bottom.y, bottom.z );
capsule.add( sphBottom );
}
}
return capsule;
var helix = new THREE.Object3D();
var bottom = new THREE.Vector3();
var top = new THREE.Vector3();
var openBottom = false;
var openTop = false;
var sine_sign = false;
bottom.set( radius, -height/2, 0);
for (var i = 1; i <= arc*radicalSegment ; i++ )
{
top.set(radius * Math.cos( i * 2 * Math.PI/ radialSegments ),
height * (i / (arc*radialSegments)) - height/2,
sine_sign * radius * Math.sin(i * 2*Math.PI/ radialSegments));
var capsule = createCapsule(material, tube, top, bottom, tubularSegments, OpenTop, openBottom );
helix.add ( capsule );
openBottom = true;
bottom.copy( top );
}
return helix;
[/javascript]
cylinder = new THREE.Mesh(
new THREE.CylinderGeometry(5, 5, 200, 32), crossbarMaterial);
cylinder.position.set(0, 360, 0);
cylinder.rotation.x = 90 * Math.PI / 180.0;
scene.add( cylinder );
cylinder = new THREE.Mesh(
new THREE.CylinderGeometry(6, 14, 70, 32), headMaterial);
cylinder.position.set( -70, 530, 0);
cylinder.rotation.z = 90 * Math.PI / 180.0;
scene.add( cylinder );