unity3d-role Controller Cont.

Source: Internet
Author: User

Self-study is a persistent and lonely process, write a blog is a summary and growth process, refueling!

Role Controller Cont.

Before I learned the role of roaming, but there are many effects are not what I want. Only their own hands-on practice to heed the mystery. So I've been thinking about it for a while.

In order to write the article complete. So the terrain to the role controller a process is written down

Terrain terrains

1: New Terrain

After you create a new terrain. can set the parameters of the terrain, the development of the pre-set terrain configuration, the development of the medium, if the terrain is set. The terrain will become the initialization state

2: Parameter setting

Select the Terrain object and you can see the Terrain menu bar in the Inspector

Click Terrain Settings to find the following resolution options

3: Editing the terrain

Now you can come up with your own artistic. You can start doodling as you go. A few minutes later ...

Next look at the second: editing terrain-specific heights

The third is a smooth transition, which makes the terrain more rounded. You can try it yourself. I can't.

The fourth one is the terrain map. Add a Zhangshan map to the terrain,

Unity has built-in terrain resources. OK, guide pack

After the import is complete. The resource contains a map, a tree. Flowers, etc.

You'll find that you can add multiple posters here. The first default is that the terrain is the entire color, if you want to draw other colors above, you can add a second map, such as now want to paint green

Now add a green map, then check the green map and draw it in the terrain with a brush.

Of course, you can delete the decal and edit the map. Achieve the effect you want.

The fifth one is to add a tree. The sixth one is to add grass and add the same method as the map above. Not even

Take a look at some of the tree's parameter explanations

The parameters of the grass are not. Similar to the above. Then in the Add Sky box (the previous blog introduced how to use), and finally my coating effect.

Now it's time to get to the role controller.

Role controllers

The role controller component is saved in the Unity Standard resource Bundle, which simulates the first person or third person view, which is not limited by the rigid body, OK, since it is a resource bundle, the Guide package Bai.

Import package-->character Controller Fix

1: First person. In the first person view, the entire game view is like the protagonist's eyes, the game screen everything seems to be seen from their own eyes, just as the CS game.

2: Third person. In the game scene contains the protagonist and camera, the protagonist moved, the camera will always follow the protagonist to move, so the game has been able to see the protagonist's current direction of movement.

Look at the role Controller resource pack that you just imported

Select first person or third person to drag into scene view, run game See effect (WSDA move spacebar to jump)

Look at the effect: what problems will you find?

1: When I drag the third person role controller into the Sceen view. Half of it is in the terrain. Such You need to drag him over the terrain, or you'll fall off.

2: Find out if he can walk through trees, because trees are the resources built into the terrain. There is no way to solve it. Unless you import the tree model separately. Then add the controller to the model.

Now see these. Can't wait to do a game character to simulate these effects.

Ok. Take the "character roaming" article blog.

1: New Terrain

2: Import Roles

3: I import the tree model and stone here. So the character can't go through trees or rocks.

In order not to cross the stone. So to add a collider character to both the stone and the character, you'll find out when the character hits the rock hard. The role of the rigid body will rebound, then the problem comes.

So this is where the role controller component is used, that is, the component, the role controller component and the rigid body component have the physical engine function, they all need to bind in the game object, in order to achieve the physical effect

And only one of the two can exist in the same game object. Rigid body components can simulate all the physical effects of a model in the real world very accurately, while the role controller component is less precise than a rigid body, and it is more limited by the controller, so it is more suitable for controlling game objects

Interested can go and try. It's written here today, and there's no code here that's a theory. Next write the role controller component, and control the role with code

unity3d-role Controller Cont.

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.