You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
527 B
19 lines
527 B
10 months ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
|
||
|
public class FollowCamera : MonoBehaviour
|
||
|
{
|
||
|
|
||
|
// Distance between player and camera in horizontal direction
|
||
|
public float xOffset = 0f;
|
||
|
// Distance between player and camera in vertical direction
|
||
|
public float yOffset = 0f;
|
||
|
|
||
|
// Reference to the player's transform.
|
||
|
public Transform player;
|
||
|
|
||
|
void LateUpdate()
|
||
|
{
|
||
|
this.transform.position = new Vector3(player.transform.position.x + xOffset, this.transform.position.y + yOffset, -10);
|
||
|
}
|
||
|
}
|