Jedność, jak dodać siłę
public Rigidbody rb;
if(Input.GetKey(KeyCode.W))
{
rb.AddForce(100, 0, 0);
}
Envious Emu
public Rigidbody rb;
if(Input.GetKey(KeyCode.W))
{
rb.AddForce(100, 0, 0);
}
private Rigidbody2D rb;
public Vector2 direction;
public float force;
void Start()
{
rb = GetComponent<Rigidbody2D>();
rb.AddForce(direction * force, ForceMode2D.Impulse);
//rb.AddForce(--pass in Vector--, --can pass in ForceMode--);
}