Unity3d the implementation of the air wall for Android development notes

Source: Internet
Author: User

By doing Unity3d demo, I found a few small problems, and solved a lot of problems, I did not record in time, I will be through the way of essays to record my growth experience, here first to remember the time I lost. t.t.

However, starting from today, the first thing to do is to put my Demo function Update implementation method here, for your future reference, to provide a small solution.

First put a game chart, do is a person, walking on the map, today is to talk about how to achieve the air wall discussion.

  

As we all know, in general, the map is limited in size, we do not need to run to some restricted locations, such as the limit edge of the map, so the loss of controllability, and easy to trigger a variety of accidents. So the best way is to limit the player's range of action, which appears in the game of the famous air wall, obviously 3D game, you can see the sight, but by a wall of air blocked the way. This is not to let you go, but you passed, the trouble, so, is called the conscience of the work, the general scope will be wide, because more of the consideration, and some of the work of the works, in order to avoid encountering unexpected situation, like the player as close as possible in the "air wall", so easier to write programs. The digression says much, let's talk about the principle. In fact, the air wall is based on the Collider collider, the collider detects that our character is in contact with the air wall, so we limit the role of the coordinates, do not let him cross the fence, and most of the air wall using what method to avoid the player to cross it?

Some people suddenly think, with similar to the map plane, we can stand on the plane, can not wear the past, is because the map with Collider property, if we get a piece of "plane", put up, add Collider, do not make the air wall? This is possible, but the plane---is also plane is based on mesh vertex, which is based on mesh vertices, and the collision wall has no thickness, the risk of the object passing through the collision wall is higher. The more formal approach should be to use box collider stitching, conducive to computational efficiency and reduce miscalculation. For examples, you can refer to some of the official demos and some of the already mature game demos.

Come, that angry-bots I come to you to cut a picture, everybody knew, in that official game demo, how the program ape realizes the air wall.

You see, in the environment under the collider inside there are a lot of capsule and cube are used to mosaic complex air wall system, and open one of the cube, we see, in the left image is a wall, but we can not be too close to the wall, Because the wall is equipped with an air wall, we open the mesh in the right image, and see the map of the front is indeed a dense mass of a cuboid block.

OK, now we have discussed the correct use of the air wall practice, and progress together ~ ~ ~

Unity3d the implementation of the air wall for Android development notes

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.