Hello im super new and i´m trying to make a spell that is an earth wall rising from the ground.
i managed to google everything so far but i cant get the wall to rotate in relation to my main character.
the game is like top down view with an angle im using a navmesh and a navmeshagent to navigate.
thats what i got so far
public class EarthWall : MonoBehaviour {
public float cooldownTime;
private float nextFireTime;
Ray myRay;
RaycastHit hit;
public GameObject objectToInstantiate;
// Update is called once per frame
void Update () {
if (Time.time > nextFireTime)
{
myRay = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(myRay, out hit))
{
if (Input.GetKeyUp("q"))
{
Instantiate(objectToInstantiate, hit.point, Quaternion.identity);
nextFireTime = Time.time + cooldownTime;
}
}
}
}
}
i hope i made my point clear my english is not the best im sorry.
thanks for any help i get
as a bonus question, i want the wall to only be casted in a certain range from the player