官术网_书友最值得收藏!

And how do I say that in Java?

Imagine an arrow pointing from the origin to an X-Y-Z coordinate. This arrow is called a vector. You will be using vectors to represent locations. Since a vector always starts at the origin, and the arrow points in the direction of the given (x,y,z) coordinates, a vector can also be used to specify a direction. Quite useful!

In your Java code, you use the com.jme3.math.Vector3f class for this data type. A Vector3f is an object with three float components, x, y, and z. For example:

Vector3f v = new Vector3f( 2.0f , 3.0f , -4.0f );

Remember when we created the blue cube earlier and placed it in the middle of the scene? We positioned it at the location Vector3f.ZERO. This built-in constant stands for a Vector3f(0f,0f,0f). The (0,0,0) coordinates vector represents the origin of the coordinate system, the middle of the scene.

Now that you know how to orient yourself in 3D space, we can apply this knowledge and transform our blue cube; let's position, resize, and turn it. In terms of 3D graphics, we say that we translate, scale, and rotate the object. In the next three sections, we look at each of the three transformations in detail, and learn the appropriate Java syntax.

主站蜘蛛池模板: 浠水县| 砀山县| 屏南县| 清原| 南通市| 普陀区| 依安县| 邵阳县| 江门市| 衡阳市| 云梦县| 即墨市| 乌兰浩特市| 石首市| 雷波县| 宁乡县| 枝江市| 突泉县| 榕江县| 泰安市| 舒兰市| 阜新市| 贵阳市| 武义县| 临沧市| 安岳县| 秭归县| 同德县| 新兴县| 陵水| 安福县| 云林县| 江安县| 垣曲县| 湖口县| 安西县| 台东县| 高阳县| 临江市| 东乌珠穆沁旗| 绵阳市|