以恒定的速度移动物理物体 [英] moving physics body at a constant speed

查看:106
本文介绍了以恒定的速度移动物理物体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用2D物理引擎,该引擎在刚体上具有典型的物理属性

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.

推荐答案

只有在Universe中才能实现恒定的速度.因此,您必须消除摩擦(没有空气进入),重力(没有其他质量拉动物体来加快或减慢其速度)等.如果这些效果适用于每个物体,这将非常奇怪.应用中的其他对象,但不是这个对象.

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.

所以...将质量设置为1(或其他合适的值),将摩擦设置为零,将重力设置为零,将线性阻尼设置为零,将线速度设置为1(或您想要的任何数字),设置没有冲动.

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.

这篇关于以恒定的速度移动物理物体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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