3D Game Programming
❶ varshape =newTHREE.SphereGeometry(100, 20, 15); varcover =newTHREE.MeshNormalMaterial(); varball =newTHREE.Mesh(shape, cover); ...
Size: CubeGeometry(300, 100, 20) To create a box, we’ll write more JavaScript below everything that we used to create our ball. ...
Setting the box rotation to (0.5, 0.5, 0) should rotate the cube so we can see that it really is a cube: Each side of a cube doe ...
Using Cylinders for All Kinds of Shapes A cylinder, which is also sometimes called a tube, is a surprisingly useful shape in 3D ...
And a cylinder that has either the top or bottom with a size of 1 is a cone: It should be clear that you can do a lot with cylin ...
Try This Yourself Play with different numbers and see what you can create! Were you able to figure it out? Don’t worry if you we ...
varshape =newTHREE.PlaneGeometry(100, 100); varcover =newTHREE.MeshNormalMaterial(); varground =newTHREE.Mesh(shape, cover); sce ...
Figure 1—A Chunky Donut TorusGeometry(100, 25, 8, 25) Like the sphere, the donut shape is built from chunks. The chunks can be m ...
varshape =newTHREE.TorusGeometry(100, 25, 8, 25, 3.14); varcover =newTHREE.MeshNormalMaterial(); vardonut =newTHREE.Mesh(shape, ...
1.4 The Code So Far To make things a little easier, the completed version of this project is included as part of Section A1.1, C ...
CHAPTER 2 Playing with the Console and Finding What’s Broken When programming within web browsers, it’s extremely useful to be a ...
Let’s call the new project Breaking Things. Be sure to leave the template set to 3D starter project. Now let’s open the browser’ ...
Let’s start by breaking simple things that the ICE Code Editor can tell us about. 2.3 Debugging in ICE: The Red X A red X next t ...
Let’s put this in action by writing some more bad JavaScript (but not too bad). First, remove the bad()javascript line from the ...
To resolve this problem, let’s tell our JavaScript program how to eat food. We do this by adding a function that explains eating ...
our program (your line numbers may be slightly different). However, the misspelled word is not on line 25 in ICE. Our problem ac ...
Don’t worry about the Object[objectObject] part of the message, as it’s not telling us anything helpful at this point. In this c ...
Fix the last thing that you typed to break ICE, and then remove the edit-only question mark from the URL so that you’re back at ...
CHAPTER 3 Project: Making an Avatar Developing games involves building a lot of parts, such as the game area, the players in the ...
3.1 Getting Started Let’s open the ICE Code Editor^1 again and create a new project named My Avatar (check Start a New Project, ...
«
1
2
3
4
5
6
7
8
9
10
»
Free download pdf