Skip to content

fix wrong jump height in case platform #778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 12, 2019
Merged

fix wrong jump height in case platform #778

merged 1 commit into from
Oct 12, 2019

Conversation

Marssssssss
Copy link
Contributor

@Marssssssss
Copy link
Contributor Author

修改之前是在离开碰撞的时候让物体的速度受重力影响,但是实际上在跳跃状态开启的瞬间就拥有了初速度但是还未离开碰撞,这时候就会出现一帧的匀速运动,从而导致不同帧率在这一帧中的匀速运动距离不同而影响到跳跃的最高高度。同时修改之前物体的移动距离是使用 speed.y * dt 来算的,实际上和匀变速运动的距离会有差距。
综上,具体改动如下:
1、更改受重力影响的条件为跳跃状态开启时就影响。
2、更改 y 轴距离计算公式,采用匀变速运动的规律计算每次距离的改变量。
3、在赋速度初值的时候如果跳跃初始速度高于最高速度就将速度初值改为最高速度。

@knoxHuang knoxHuang merged commit db056f6 into cocos:v2.1.4-release Oct 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants