Constant Force 恒力

优质
小牛编辑
124浏览
2023-12-01

Constant Force is a quick utility for adding constant forces to a Rigidbody. This works great for one shot objects like rockets, if you don't want it to start with a large velocity but instead accelerate.

恒力是一种快速有效地给刚体添加恒定外力的方法。适用于类似于火箭等射出的对象,如果你不希望其初速度很大而是不断加速。

A rocket propelled forward by a Constant Force 一枚被恒力推动前进的火箭
A rocket propelled forward by a Constant Force 一枚被恒力推动前进的火箭

Properties 属性

  • Force 力 The vector of a force to be applied in world space.
    被施加的力在世界坐标中的矢量
  • Relative Force 相对力 The vector of a force to be applied in the object's local space.
    被施加在对象上的力在本地坐标中的矢量
  • Torque 扭矩 The vector of a torque, applied in world space. The object will begin spinning around this vector. The longer the vector is, the faster the rotation.
    施加在世界坐标中的扭矩矢量。对象将绕着该矢量转动。矢量越长,转速越快。
  • Relative Torque 相对扭矩 The vector of a torque, applied in local space. The object will begin spinning around this vector. The longer the vector is, the faster the rotation.
    施加在本地坐标中的扭矩矢量。对象将绕着该矢量转动。矢量越长,转速越快。

Details 细节

To make a rocket that accelerates forward set the Relative Force to be along the positive z-axis. Then use the Rigidbody's Drag property to make it not exceed some maximum velocity (the higher the drag the lower the maximum velocity will be). In the Rigidbody, also make sure to turn off gravity so that the rocket will always stay on its path.

沿着z轴正方向设定相对推力会使火箭向前加速。使用刚体的Drag属性使其不会超过某个最大速度(drag越大,最大速度会越小)。刚体中的万有引力也要保证关掉,这样火箭将会一直保持其路径。

Hints 提示

  • To make an object flow upwards, add a Constant Force with the Force property having a positive Y value.
    施加包含沿Y轴正方向Force属性的恒力,可以使对象朝上飞。
  • To make an object fly forwards, add a Constant Force with the Relative Force property having a positive Z value.
    施加包含沿Z轴正方向Relative Force属性的恒力,可以使对象向前飞