Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseFor some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Closeforce | The force vector in local coordinates. |
mode | The type of force to apply. |
Applies a force
to the Articulation Body, relative to its local coordinate system.
You can only apply a force to an active ArticulationBody. If a GameObject is inactive, AddRelativeForce has no effect.
For more information on how ForceMode affects velocity, see Rigidbody.AddForce.
Applying a force to an ArticulationBody wakes up that body. If the force size is zero then the ArticulationBody does not wake up.
Unit of measurement - N (newtons).
See Also: AddForce, AddForceAtPosition, AddRelativeTorque.
using UnityEngine; using System.Collections;
// Add a thrust force to push an object in its current forward // direction (to simulate a rocket motor, say). public class ExampleClass : MonoBehaviour { public float thrust; public ArticulationBody ab; void Start() { ab = GetComponent<ArticulationBody>(); }
void FixedUpdate() { ab.AddRelativeForce(Vector3.forward * thrust); } }