Alternative to rb.velocity

Is there a command to either add a certain amount to velocity instead of setting it, or to only add velocity to one of the three dimensions (XYZ)?

Usually it’d be rb.AddForce(Vector3 force)
To add velocity to only one dimension you would do e.g. rb.velocity += new Vector3(5, 0, 0)

You can add Vector3 velocities together:

Vector3 velocityToAdd = new Vector3(5, 0, 0);
Vector3 currentVelocity = rb.velocity;

rb.velocity = velocityToAdd + currentVelocity;

Thanks. Both very helpful responses

1 Like