返回资讯中心
外部精选
软件工程
#开发者实时流

Novel Collision Approximation (2023)

Game engines use state to handle collisions, constantly updating the positions of particles until a collision is detected. This approach is logical for games because graphics are displayed chronologically, but this isn’…

Hacker News 最新vismit20002026/11/26 · 今天4 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

Apr 09, 2023

Game engines use state to handle collisions, constantly updating the positions of particles until a collision is detected. This approach is logical for games because graphics are displayed chronologically, but this isn’t necessarily the best system for education-oriented physics simulations, as to get the state for a time far in the future we’d need to simulate all ticks up until that point. Instead, we can use a little bit of math to create a stateless and functional approach to collision simulation.

To demonstrate, I use algebra to calculate the range of times when two particles can collide on the x axis, and use these bounds to calculate the specifics of potential collisions.

The first step is to isolate t in the following equation, which is the solution for all times two point masses will collide on the x axis given uniform acceleration.

After a massive amount of algebra, this gives us:

To account for radii, we modify the first equation to the following:

And now get the following when isolating for t:

Now we know that if the two particles collide, it will be some time (inclusively) between the two t values. This is done with virtually no computational burden. To account for an N-dimensional systems, we repeat the process N times and brute force the solution in the intersection of time intervals.

What are the consequences of this? That is left as an exercise for the reader.

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →