// Update is called once per frame void Update() { if (can.GetCan()) { Pular(); } }
private void FixedUpdate() { float aux = Input.GetAxis(ipt); if (can.GetCan()) { if (aux > 0) { transform.rotation = new Quaternion(0, 0, 0, 0); rb.velocity = new Vector2(vel, rb.velocity.y); } else if (aux < 0) { transform.rotation = new Quaternion(0, 180, 0, 0); rb.velocity = new Vector2(-vel, rb.velocity.y); } else { rb.velocity = new Vector2(0, rb.velocity.y); } } }