- Home /
Question by
sturthestu · Mar 30 at 03:47 AM ·
rigidbody.addforce
Unity Rigidbody Addforce not working
Hey, I am using addforce for movement and want to cancel it out so it doesn't slide. Currently I have this code.
void CancelHorizontalVelocity() { rb.AddForce(Vector3.forward -rb.velocity.z, ForceMode.VelocityChange); rb.AddForce(Vector3.right -rb.velocity.x, ForceMode.VelocityChange); }
This for some reason multiplies the opposite variables so if your moving forward, it add force to the right instead of back.
Comment