[Unity3D] Unity3D Game Development

Source: Internet
Author: User

Hello everyone, I'm Qin Yuanpei. Welcome to follow my blog. My blog address is blog.csdn.net/qinyuanpei.

In my previous article "Implementation of small maps for Unity3D game development", I explained how to use the OnGUI () method to map small maps. So, today, the blogger will share with you a small map implementation method. Before officially starting today's article, let's take a look at the camera in Unity3D. In Unity3D, a camera is a device that can capture and display the game world for players. By manipulating cameras, we can display our game scenarios in a more real and unique way. In Unity3D, the Main Camera is used by default to display the game scenario we designed. In fact, in a game scenario, we can set multiple Camera objects, they can also be set to any Rendering sequence, any rendering part, and any rendering position. Next, let's explain some important things!

1. Clera Flags: determines which part of the scenario needs to be cleared. This is useful when multiple cameras are needed to display different game elements.

2. Background Color: Background Color after all objects. After this attribute is set, the sky box (SkyBox) becomes invalid.

3. Normalized View Port Rect: use four values in the screen coordinate system to determine which parts of the camera will be displayed on the screen.

4. Near Clip Plane: Draw points Near the camera.

5. Far Clip Plane: Draw point Far away from the camera.

6. Field of view: the camera angle width along the local Y axis.

7. Is orthographic: Enables or disables the camera's depth of field effect.

8. Orthographic size: the size of the view in Orthogonal mode.

9. Depth: the camera's Rendering sequence, which is equivalent to the ZIndex attribute. A camera with a higher Depth will be drawn on a camera with a lower Depth.

Well, with the above foundation, we can start today's official content. It is a game scenario created by the bloggers themselves, the game scenario is in a dark room without light, and a point light source is added to the head of the game's main character, so when the game's main character moves, the scene is illuminated by the light source above the head of the main character. What we need to do now is to add a small map for this game scene, to prevent players from getting lost in the dark room when playing games.


Now let's start to make a small map. We add a Camera in the scene and set its rotation angle to make it perpendicular to the XOZ plane, named TopCamera, at this time, we set the Camera projection method to orthogonal projection. I believe that according to some of the content about Camera mentioned above, we have already guessed the principle of making this small map, this small map is made based on the Normalized View Port Rect attribute. We can adjust the four values of Normalized View Port Rect on our own to make the map display the appropriate content at the right position. Below are some of the values set by the blogger to TopCamera for your reference:

In this way, our small map is ready. Let's take a look at the effect! The red box in the figure shows the correspondence between the game scene and the map. When we move a character, the role positions on the map will be updated at the same time! Today's map didn't write a line of code. What a wonderful thing is it. Haha


Like me, please remember my name: Qin Yuanpei. My blog address is blog.csdn.net/qinyuanpei!
Reprinted please indicate the source, Author: Qin Yuanpei, the source of this article: http://blog.csdn.net/qinyuanpei/article/details/23628275

Good night everyone!

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.