| George 的个人资料George's XNA Programming日志列表网络 | 帮助 |
|
|
2月17日 The Very Best of Collision DetectionCollision detection is probably one of the trickiest things in game development. A major problem associated with collision detection is that as the number of objects increases for which you need to check whether they collide or not, performance of the game drops. With a couple of sprites you may not even notice any performance issues, but when the number of sprites becomes relatively high (a machine gun is a good example) performance may seriously suffer. Things get worse when you need to detect collision between animated sprites. The aim of this post is to give you a number of links where you can find how other folks implement collision detection. A general approach is a two-stage process. The first stage is to check for potential collisions using a bounding box. If the first stage reveals a potential collision, the next stage is to perform a pixel level collision detection. Gary Kacmarcik has collision detection implemented in his XNAExtras. A good feature of Gary's method is that you can set if you need a pixel level detection or if the bounding box detection is enough. You can read more at http://blogs.msdn.com/garykac/archive/2006/09/24/769335.aspx. Another destination that I can recommend is an article by Michael Morton, which can be found here: http://www.ziggyware.com/readarticle.php?article_id=48. I would also recommend reading another, more advanced article by Michael, where he expands his method to rotated sprites. It can be found here: http://www.ziggyware.com/readarticle.php?article_id=52 Chris Taylor's article is also very good and provides enough theory in a short but easy to understand manner: http://dotnetjunkies.com/WebLog/chris.taylor/archive/2006/09/30/148798.aspx. 引用通告 (1)此日志的引用通告 URL 是: http://xnadev.spaces.live.com/blog/cns!8B6E83562E8DE240!132.trak 引用此项的网络日志
|
|
|