This question was
closed Mar 16, 2017 at 11:51 PM by
Icey_Code for the following reason:
The question is answered, right answer was accepted
I am trying to offset the camera from the player at all times even if the player moves.
The camera just positions itself right in front of the player. like 1st person. But I want it behind the player. no matter what value i change for the x, y, z it stays in the same place.
using UnityEngine;
public class MoveCam : MonoBehaviour {
public GameObject Sphere;
public GameObject CamM;
public float xOffset = 100; //100 is just a test value
public float yOffset = 100;
public float zOffset = 100;
void Start () {
}
void Update () {
}
void LateUpdate() {
CamM.transform.position = new Vector3(Sphere.transform.position.x + xOffset, Sphere.transform.position.y + yOffset, Sphere.transform.position.z + zOffset);
}
}
Thank you!
Comment
Follow this Question
Related Questions
GameObject has undefined tag! 0 Answers
Help with error in unity. 1 Answer
spawning coins in an endless runner. pausing function for a specific time? 1 Answer
Unity VR WebSocket Connection to ThingsBoard Error 'Failed to parse websocket command!' 1 Answer
I am trying to offset camera x distance from player all the time. Even if the player moves. 1 Answer