Ok, well I have this really simple C# script and there is this one stupid litttle thing I can’t figure out, yes I have search the web. But I could not find any answers…
using UnityEngine;
using System.Collections;
public class Terrain : MonoBehaviour {
public Transform[] trees;
public Transform user;
public Transform terrain;
private bool getTerrain = true;
private bool terrainComplete = false;
void Update(){
if(getTerrain == true)
{
Instantiate (terrain, transform.position, transform.rotation);
Instantiate (user , transform.position , transform.rotation);
getTerrain = false;
terrainComplete = true;
}
}
}
What I would like is that when the terrain is made, the user spawns. But I wanted it to be in the middle of the terrain, not the edge where the user just… fall off.
I have tried doing stuff like Vector3(50, 2, 50) but somehow, that does not work in C#. how else could I make the user spawn in the middle of the terrain. by the way, the terrain is positioned at 0, 1, 0.