XNA& Farseer - 与随机边缘形状的碰撞
我在我的 XNA 项目中设置了 Farseer,并且有一个由于重力而不断下落的玩家身体。我希望玩家做的是使用“从图像创建形状”功能“着陆”在窗口中的随机边缘图像上。如何使玩家身体对象与形状碰撞?
I have setup Farseer in my XNA project and have a player body which falls endlessly because of gravity. What I want the player to do is "land" on the random edged image I have in the window using the create shape from image function. How do I make the player body object collide with the shape?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你不必明确地做任何事情......只需将身体添加到同一个世界中,它们就会根据你赋予它们的属性(质量、形状等)发生碰撞。
此代码示例来自文档。我强烈建议下载演示并查看每个演示是如何用代码构建的。它会对你有很大帮助:-)
You shouldn't have to do anything explicitly ... just add the body into the same world and they will collide based on the properties you've given them (mass, shape, etc.).
This code sample is from the documentation. I highly suggest downloading the demos and seeing how each demo is constructed in code. it will greatly help you :-)