问题
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:
- Make the objects slower.
- Make the objects bigger.
- Update collision on intermediate steps.
- 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