Hello everyone!
I’m absolutely stumped. I spawn a player into the game along with a camera and a few blocks, but I can’t fathom at all how to get that camera to follow the character once it’s been spawned. I attempt to attach a camera to the spawn using the AddComponent method, which loads the camera into the scene absolutely fine. It’s just the tracking I can’t figure out. Any insight would be most appreciated!
var playerPrefab:transform;
var target:Transform;
var cam:Camera;
function Start() {
target = Instantiate (playerPrefab, transform.position, Quaternion.identity);
cam = gameObject.AddComponent(Camera);
}
function Update() {
// Presumably camera controls go in here such as lookat(target)?
}
Thanks very much!