开发者

Collisions and velocity, how do I predict hits that will take place between this update and the next?

开发者 https://www.devze.com 2023-01-11 11:32 出处:网络
I\'m doing simple col开发者_如何学运维lisions on moving, coloured pixels. If their velocity get\'s higher than 1, the pixels may pass through something in the static world I\'m trying to collide with.

I'm doing simple col开发者_如何学运维lisions on moving, coloured pixels. If their velocity get's higher than 1, the pixels may pass through something in the static world I'm trying to collide with.

How do I compensate for this?


This C++ example uses a vector based approach to predicting the paths of particles undergoing elastic collisions. This Java example is similar, rewinding to the start of a collision between particles when overlap is detected. In each, the critical element is separating the model from the view. By doing so, it's possible to iterate the model at 1 pixel/tick and update the view at a different, variable rate.

The article 2-Dimensional Elastic Collisions without Trigonometry may also be helpful.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号