Unity - 快速移动物体的碰撞失败 [英] Unity - collision failure for fast moving objects

查看:48
本文介绍了Unity - 快速移动物体的碰撞失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有人对如何处理 Unity 中缺少碰撞的快速移动对象有任何建议.我正在为手机创建一个突破游戏,发现当桨移动得非常快时,它会错过与球的碰撞.我将碰撞更改为连续检测,但这会引发奇怪的行为,例如碰撞时桨被推下.

Does anyone have any suggestions on how to deal with fast moving objects missing collisions in Unity. I am creating a breakout game for mobile and discovered that when the paddle is moved very fast then it misses the collision with the ball. I changed the collision to continuous detection but that throws up weird behaviour such as paddle being pushed down on collision.

我还尝试使用 dontgothrough 脚本使其适用于 2D 对撞机,但没有成功.有人有什么建议吗?

I also tried playing around with the dontgothrough script to make it work for 2D colliders without success. Anyone have any suggestions?

推荐答案

与快速移动的物体发生碰撞是许多游戏引擎中的一个问题.有几种处理方法:

Collision with fast moving objects is a problem in many game engines. There are a few ways of dealing with it:

  1. 使对象变慢.
  2. 使对象更大.
  3. 更新中间步骤的碰撞.
  4. 计算对象路径并尝试找到它与其他对象碰撞的任何点.

我建议您要么通过强制执行速度限制来阻止桨过快.使桨跟随用户的手指,但不要立即捕捉到它.这也可能看起来更好.

I would suggest you either stop the paddle from going too fast, by enforcing a speed limit. Make the paddle follow the user's finger, but not snap to it instantly. This would probably look better as well.

您也可以加宽桨,但这可能会稍微影响游戏的平衡.

You could also widen the paddle, but that might affect the game's balance a bit too much.

这篇关于Unity - 快速移动物体的碰撞失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆