本文介绍了实时计算碰撞-处理时间延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设:

  • 您正在编写一个程序,其中3个(或更多个)圆(或其他几何形状)在屏幕上实时移动,但都以不同的速度移动,由于物理原因,该速度在某些时间可能会发生变化-计算.

  • you're coding a program in which 3 (or a lot more) circles (or other geometry) move around on the screen in realtime, all with a different velocity, that can change at certain times due to physics-calculations.

只能在每一帧进行计算

每帧,您必须确保通过物理计算彼此碰撞"/在此帧与最后一帧之间的时间段内发生碰撞"的圆会相互反弹"

each frame, you have to make sure the circles who "collide"/"have collided during the time between this frame and the last" with eachother will 'bounce off' by using physics-calculations

假设在第x帧和第x + 1帧之间的时间里,三个圆会相互碰撞.但是,在第x帧期间,没有一个圆圈彼此接触.在第x + 1帧中,同样的情况适用(没有碰撞)我将尝试用图像更好地说明这一点:

Suppose that during the time between frame x and frame x+1, three circles will collide with eachother. However, during frame x none of the circles touches the other. In frame x+1, the same thing applies (none collides)I will try to better illustrate this with an image:

问题:

有什么好的方法来跟踪碰撞,从而避免由于两帧之间的一些(意外的)大延迟而跳过碰撞?

What are good ways to keep track of collision like this, so that a collision wouldn't get skipped due to some (unexpected) large delay in time between two frames?

这个问题在我脑海中徘徊了太久了...

对于认为该帖子是旧版的所有人:请参见 ,例如:https://physics.stackexchange.com/questions/18515/calculating-collisions-in-realtime-dealing-with-a-delay-time >

推荐答案

正确执行此操作: