Version: 2019.3
Configurable Joint
Fixed Joint

Constant Force

Switch to Scripting

Constant Force is a quick utility for adding constant forces to a RigidbodyA component that allows a GameObject to be affected by simulated gravity and other forces. More info
See in Glossary
. This works great for one shot objects like rockets, if you don’t want it to start with a large velocity but instead accelerate.

Properties

Property: Function:
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.

Hints

  • To make an object flow upwards, add a Constant Force with the Force property having a positive Y value.
  • To make an object fly forwards, add a Constant Force with the Relative Force property having a positive Z value.
Configurable Joint
Fixed Joint
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961