解答: createSupport()
加入以下程式:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
// 右腳底板
cube = new THREE.Mesh( new THREE.CubeGeometry( 20+64+110, 52, 6 ), cubeMaterial );
// (20+32) - 一半的寬度 (20+64+110)/2
cube.position.x = -45;
// 一半的高度
cube.position.y = 52/2;
// 反方向偏移 77 + 一半的深度 6/2
cube.position.z = -(77 + 6/2);
scene.add( cube );
// 右腳
cube = new THREE.Mesh( new THREE.CubeGeometry( 64, 334+52, 6 ), cubeMaterial );
// X 對齊原點
cube.position.x = 0;
cube.position.y = (334+52)/2;
// 反方向偏移 77 + 一半的深度 6/2
cube.position.z = -(77 + 6/2);
scene.add( cube );
|
createBody()
加入以下程式:
1
2
3
4
5
6
7
8
9
10
11
12
13
|
// 身體
var sphere = new THREE.Mesh( new THREE.SphereGeometry( 116/2, 32, 16 ), sphereMaterial );
sphere.position.x = 0;
sphere.position.y = 160;
sphere.position.z = 0;
scene.add( sphere );
// 頭/身體間圓柱
var cylinder = new THREE.Mesh( new THREE.CylinderGeometry( 24/2, 24/2, 390, 32 ), cylinderMaterial );
cylinder.position.x = 0;
cylinder.position.y = 160 + 390/2;
cylinder.position.z = 0;
scene.add( cylinder );
|
createHead()
加入以下程式:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
// 頭
var sphere = new THREE.Mesh( new THREE.SphereGeometry( 104/2, 32, 16 ), sphereMaterial );
sphere.position.x = 0;
sphere.position.y = 160 + 390;
sphere.position.z = 0;
scene.add( sphere );
// 帽緣
var cylinder = new THREE.Mesh( new THREE.CylinderGeometry( 142/2, 142/2, 10, 32 ), cylinderMaterial );
cylinder.position.x = 0;
cylinder.position.y = 160 + 390 + 40 + 10/2;
cylinder.position.z = 0; scene.add( cylinder );
// 帽頂
cylinder = new THREE.Mesh( new THREE.CylinderGeometry( 80/2, 80/2, 70, 32 ), cylinderMaterial );
cylinder.position.x = 0;
cylinder.position.y = 160 + 390 + 40 + 10 + 70/2;
cylinder.position.z = 0;
scene.add( cylinder );
|