推着一艘宇宙飞船
我有一艘太空飞船,底部有两个推进器,一个在左边,一个在右边。
当右侧推进器打开时,它应该在加速时以抛物线曲线向左推动太空飞船。左推进器则相反。
我该如何实施?
我在 box2d 上发现了一种叫做“弧度脉冲”的东西,这能完成这项工作吗?
我还希望物理学能够稍微反转正确的推力(有点像那些只有一个按钮的廉价遥控汽车),但前提是在之前的一定时间内使用了另一个推进器。
任何库的工作示例(或指向正确方向的东西)就足够了。
I have a spaceship with two thrusters on it's base, one on the left and one on the right.
When the right thruster is on it should push the space ship in a parabolic curve towards the left as it is accelerating. and the reverse for the left thruster.
How do I implement this?
I've found something called "radian impulse" on box2d, would this do the job?
I would also like the physics the reverse the right thrust for a little bit (a bit like one of those cheap RC cars with just the one button) but only if the other thruster was used within a certain amount of time prior.
A working example (or something pointing in the right direction) with any library would suffice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当你的火箭偏离中心并且只有一枚发射时,你正在给你的船扭矩。为了模拟这一点,您需要将火箭的推力分成两个部分。第一个推动你的船向前(朝它所面向的方向),第二个增加你的旋转速度。例子:
When you have rockets off center and only one fires, you are giving your ship torque. To simulate this you would need to split your rocket's thrust into two components. First one pushes your ship forward (in direction in which it is facing), second increases your rate of rotation. Example: