One Coordinate System for 3D development in Windows Phone

Source: Internet
Author: User

In Windows Phone, xNa provides a game framework for developers, which greatly improves the efficiency of game development. While enjoying the convenience of using xNa for 2D development, 3D development can also be easily implemented. I would like to introduce this in a series of articles, for your reference when you want to use xNa for 3D development in Windows Phone.

 

3D development requires more knowledge, including linear algebra and computer graphics. These theories are beyond the scope of this article. If you need them, you can find many reference books.

 

Next, let's take a look at the basic situation of the 3D world.

 

First, let's look at the coordinate system. In the 2D plane, the coordinate system is no longer familiar. It uses the Cartesian coordinate system and uniquely identifies a plane from the vertical X and Y coordinate axes, all vertices in a plane can be expressed as (x, y.

 

In 3D space, due to the introduction of depth, the plane coordinates obviously cannot meet the requirements. three-dimensional coordinates are required to represent points in space. The 3D coordinate system is also called the world coordinate system. The X, Y, and Z coordinate axes are used to introduce a Z axis perpendicular to the plane on the X and Y axes of the plane coordinate system. In Windows Phone, the right-hand coordinate system is used. When the mobile phone screen faces us, the positive side of the Z axis points to the face from the mobile phone screen. All vertices in the space are expressed in the form of (x, y, z). The origin is (0, 0, 0 ). Shows the coordinate system. (Note: The image is from Microsoft's lab manual)

 

 

Since all vertices in the space need to be expressed in the form of (x, y, z), in order to facilitate programming, xNa provides the vector3 class. The vector3 class facilitates the expression of points and vectors in the space. Common User methods are as follows:

Vector3 Pos = new vector3 (0, 0, 20 );

 

For zero vectors or common vectors, The vector3 class also provides static methods for our use. For example, to create a zero vector, you can write it:

Vector3 Pos = vector3.zero;

 

Vector3 also provides addition, subtraction, multiplication, division, and other operations, as well as intersection and distance operations, which can be conveniently used in program development.

 

In this way, we know how to use the 3D Coordinate System and Its Expression in the code, but this is not enough for 3D development. Imagine an object in a space, although its coordinates remain unchanged, can be viewed from any angle, but the results are different from each angle. Therefore, only the coordinate system is not enough. We need to add new content to determine the real expression of objects in a space. I want to know what is going on later, and it will be broken down later.

 

-- Welcome to reprint, please indicate the source of http://blog.csdn.net/caowenbin --

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.