使Box2d对象遵循预定路径 [英] Making a Box2d object follow a predetermined path

查看:199
本文介绍了使Box2d对象遵循预定路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个游戏,其中某个对象(建模为box2d主体)必须遵循固定的路径。是否有一种方法,通过它我可以指定路径坐标,并使对象提前它为每个dt?



感谢

另一种选择:




  • 将鼠标连接到您的身体

  • 使用鼠标关节的setTarget方法移动身体


I'm making a game in which a certain object (modelled as a box2d body) has to follow a fixed path. Is there a way by which I can specify the path coordinates and make the object advance over it for each dt?

Thanks

解决方案

Another option:

  • Attach a mouse joint to your body
  • Use setTarget method of the mouse joint to move the body

这篇关于使Box2d对象遵循预定路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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