Hey, already asked question on "unity answers but none answered so I might try here then too…
I followed tutorial at https://www.youtube.com/watch?v=SlEFoM4h3Mc&t.
As couple guys already mentioned on latest comments at yuotube: When shooting the other way (flipping the sprite on x-axis) the projectile shoots from a different spot. (from feet instead of bit up from head)
I made a test scene in case someone got time to check it out. To test shooting/throwing press “Q”.
{
public GameObject projectile;
public Vector2 offset = new Vector2(1f, 1f);
public Vector2 velocity;
float cooldown = 1;
bool canThrow = true;
void Update()
{
if (Input.GetKeyDown(KeyCode.E) && canThrow)
{
GameObject clone = (GameObject)Instantiate(projectile, (Vector2)transform.position + (offset * transform.localScale.x), Quaternion.identity);
clone.GetComponent<Rigidbody2D>().velocity = new Vector2(velocity.x * transform.localScale.x, velocity.y);
StartCoroutine("CanThrow");
}
}
IEnumerator CanThrow()
{
canThrow = false;
yield return new WaitForSeconds(cooldown);
canThrow = true;
}
}