Unity advanced improvement – 2D game jumping feel optimization (jumping and falling)
Unity advanced improvement – 2D game jumping feel optimization (jumping and falling) When developing 2D games, jumping is an indispensable and important function. However, when we were developing in Unity, Unity’s own physics engine did not provide a very good feel. It felt light when falling, which was obviously very uncomfortable to operate. Therefore, we need to optimize the jump ourselves to get a better feel. It is not difficult to find that in most 2D games when jumping, the falling speed is much faster than the rising speed, and the falling time is about half of the rising speed. Tip, when optimizing jumps, rigid body components will be used First, we need to analyze the jumping phase of Unity objects: In the picture, jumping is divided into two stages. The first stage is the jumping stage, the rising stage of the character, and the second stage is the falling stage In the first stage, the upward velocity of the rigid body is positive, that is, velocity.y>0; in the second stage of falling, the object’s velocity.y<0, so we can determine the location of the object by the positive and negative velocity.y At which stage, objects can be manipulated more precisely.…