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

查看:257
本文介绍了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. 计算对象路径,并尝试查找与其他对象碰撞的任何点。
  5. li>
  1. Make the objects slower.
  2. Make the objects bigger.
  3. Update collision on intermediate steps.
  4. Calculate the objects path and try to find any points where it collides with other objects.

我建议您通过限制速度来阻止桨过快。让划桨顺着使用者的手指,但不要立即抓住它。

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天全站免登陆