Hey,
I am learning Unity but have C and objective C programming experience. I have a test going on where I imported the FPSController asset for a first person camera. I then grabbed a tif image of a cockpit as a texture and placed in on a 3D plane asset in front of the camera. When I place the Plane as a child of the camera asset it follows the transform of the camera.
I then decided to test this with code and remove the Plane a child object and added a new script to the Plane asset.
With this code it it is causing the FPSController asset to start getting pushed away at a high rate of speed. I have no control of the forward momentum and can not stop it. I’m assuming that the plane asset is snapping to the camera which causes the camera to move, since it updates every frame it keeps pushing the camera back.
public class CameraFollow : MonoBehaviour {
public GameObject cameraObj;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
var pos = new Vector3 (cameraObj.transform.position.x ,cameraObj.transform.position.y ,cameraObj.transform.position.z);
transform.position = pos;
Debug.Log (pos);
//transform.Translate(Vector3.forward * Time.deltaTime);
}
}
If the camera is not moving there should be no transform.position data to apply to the Plane? So why is it moving? I included an image to better understand what I am doing.
