Unity - collision failure for fast moving objects

元气小坏坏 提交于 2019-12-12 04:21:41

问题


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.

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


回答1:


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

  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.



来源:https://stackoverflow.com/questions/41304071/unity-collision-failure-for-fast-moving-objects

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!