I’m making a game where a block spawns in front of the first person controller. To do this i made the following code:
var thePrefab : GameObject;
function Update () {
if (Input.GetMouseButtonDown(0)) {
var instance : GameObject = Instantiate(thePrefab, transform.position + Vector3(-1,1,0), transform.rotation);
}
}
But the object spawns only along one space in front of him on the x-axis do to “Vector3(-1,1,0)” in the code above…is there anyway to change that so that it spawns in the direction the first person controller is facing?