moving physics body at a constant speed

偶尔善良 提交于 2019-12-13 05:08:56

问题


I am working with a 2D physics engine that has the typical physics properties on a rigidbody

get/set mass, friction, bounce, gravity, linear damping, linear velocity, impulses.

I would like to move this rigidbody at a constant speed, is there some formula that I can use to uses those forces to move the body at a constant speed.


回答1:


Constant speed can only be achieved in a universe with no other matter. So, you've got to remove friction(no air to bump into), gravity(no other mass pulling on the object to speed it up or slow it down), etc. It'll look very strange if those effects apply to every other object in the app but not this one.

So... Set mass to 1(or some other appropriate value), set friction to zero, set gravity to zero, set linear damping to zero, set linear velocity to 1(or whatever number you'd like), set there to be no impulses.



来源:https://stackoverflow.com/questions/28985535/moving-physics-body-at-a-constant-speed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!