良好的2D碰撞响应参考 [英] Good 2D Collision Response References

查看:83
本文介绍了良好的2D碰撞响应参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我目前正在寻找在2D视频游戏中实现碰撞响应的各种方法,类似于本教程的Metanet具有以下内容: N教程我希望在XNA中实现某些功能,但是任何语言都可以。我对以编程方式实现的兴趣远胜于实际的理论。我希望使用更多对初学者友好的材料,但我确实欢迎更多高级主题。

Hey, I'm currently looking for various methods of implementing collision response in 2D video games, something similar to this tutorial Metanet has: N Tutorial I'm looking to implement something in XNA, but any language would be fine. I'm more interested in implementing programmatically than actual theory. I'd prefer more beginner friendly material, but I do welcome more advance topics.

那么有人可以推荐一些好的2D碰撞响应文章/书吗?

So could someone suggest some good 2D collision response articles/books?

(PS:我对响应比对检测更感兴趣)

(PS: I'm more interested in response than detection)

推荐答案

N教程是一个很好的入门资源。我还推荐非常好的文章 2D多边形碰撞检测。它带有一个出色的C#实现和使用分离轴定理进行多边形碰撞检测的示例,并更好地解释了其中的一些概念。

The N tutorial that you mentioned already is a great resource to start with. I also recommend the very good article 2D Polygon Collision Detection. It comes with a great C# implementation and example for polygon collision detection using the Separating Axis Theorem and explains some of the concepts better.

关于响应碰撞这取决于场景。对于游戏,您可能希望根据当前速度检查可能的碰撞,然后简单地调整实际速度以防止碰撞。您还可以实现某种弹跳效果。无论如何,它都可能同时调整对象的速度和方向。

As far as responding to a collision is concerned it depends on the scenario. For games you might want to check for a possible collision based on the current velocity and then simply adjust the actual velocity to prevent collision. You could also implement some sort of 'bounce' effect. In any case it will likely be adjusting both the velocity and direction of the object.

您可以使用分离轴定理进行碰撞检测并使用多边形投影来找到到特定轴上目标的距离。 (大多数情况下是您移动的矢量)。

You can use the Separating Axis Theorem to do the collision detection and also use polygon projection to find the distance to the target on a specific axis. (most of the time the vector on which you move).

这篇关于良好的2D碰撞响应参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆