Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


AddForceX(float, ForceMode2D)

Adds a force to the X component of the Rigidbody2D.linearVelocity only leaving the Y component of the world space Rigidbody2D.linearVelocity untouched.
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.Physics2DModule
public void AddForceX(float force, ForceMode2D mode = ForceMode2D.Force)

Parameters

force

The force to add to the X component of the Linear Velocity in the world space of the Rigidbody2D.

The method used to apply the specified force.

Remarks

Additional Resources: Rigidbody2D.AddForceY and Rigidbody2D.AddForce.