unity how to add force code example
Example 1: unity how to add force
public Rigidbody rb;
if(Input.GetKey(KeyCode.W))
{
rb.AddForce(100, 0, 0);
}
Example 2: unity rigidbody addforce
rb = GetComponent();
rb.AddForce(new Vector3(1.5f,1.5f,1.5f));