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

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.

主站蜘蛛池模板: 托克托县| 镇远县| 潼南县| 连城县| 上思县| 项城市| 邵阳市| 岱山县| 鄂伦春自治旗| 白水县| 仁怀市| 塔城市| 高陵县| 沙坪坝区| 南宁市| 翼城县| 深圳市| 多伦县| 龙山县| 黑河市| 丹棱县| 四子王旗| 宜章县| 神木县| 凤阳县| 邵阳县| 西林县| 囊谦县| 九江市| 汶上县| 平原县| 荣成市| 惠来县| 象州县| 会东县| 伊春市| 宣汉县| 六枝特区| 宜宾县| 忻城县| 崇州市|