I am currently working on a 2D shooter game and need help with shooting in the direction I am facing. I am following Brackeys shooting tutorial but need to change shooting in the mouses direction to the direction I am facing.
Hi here :
MyProjectile = (GameObject)Instantiate(MyProjectilePrefab, tranform.position + new Vector3(0.0f, 0.0f, 0.0f), Quaternion.Euler(0f, 0f, 0f);
You must create a prefab here i named it :MyProjectilePrefan . transform.position is used to throw it from the position of the gameobject using projectile . new Vector3(..) is used to move the projectile from the position to not let it instantiate in you gameobject (it’s better if it goes from the forward) . Quaternion.Euler(..) is used to turn the projectile (let everything to 0 if you don’t want any rotation of the projectile.