開発環境
- macOS Sierra - Apple (OS)
- Emacs (Text Editor)
- JavaScript (プログラミング言語)
- three.js (JavaScript Library)
- Safari (Web Browser)
3D Game Programming for Kids: Create Interactive Worlds with JavaScript (Chris Strom(著)、Pragmatic Bookshel)の Chapter 3(Project: Making an Avatar)の Challenge: Make the Avatar Your Own を取り組んでみる。
コード(Emacs)
var cover = new THREE.MeshNormalMaterial(); var body = new THREE.CylinderGeometry(1, 120, 150); var avatar = new THREE.Mesh(body, cover); scene.add(avatar); var head = new THREE.SphereGeometry(80); head = new THREE.Mesh(head, cover); head.position.set(0, 150, 0); scene.add(head); var hand = new THREE.SphereGeometry(50); var right_hand = new THREE.Mesh(hand, cover); right_hand.position.set(-150, 30, 0); scene.add(right_hand); var left_hand = new THREE.Mesh(hand, cover); left_hand.position.set(150, 30, 0); scene.add(left_hand); var foot = new THREE.SphereGeometry(50); var left_foot = new THREE.Mesh(foot, cover); left_foot.position.set(-60, -150, 0); scene.add(left_foot); var right_foot = new THREE.Mesh(foot, cover); right_foot.position.set(60, -150, 0); scene.add(right_foot);
0 コメント:
コメントを投稿