0
\$\begingroup\$

I have a standard camera in my scene. With standard I mean the camera you get when you click right mouse > Camera, with no modification except for the transform position and rotation. Then I attached to the camera this simple script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraController : MonoBehaviour {

public GameObject target;
public Vector3 translationOffset;
public Vector3 rotationOffset;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    transform.position = target.transform.position + translationOffset;
    transform.LookAt(target.transform);
    transform.Rotate(-rotationOffset);
}

}

the result I have is this:

camera behaviour

Why my camera is doing that? It may be worth noticing that everything was working fine, but at some point i clicked on "reimport all assets" and it started this weird behaviour. How can I fix? Thanks a lot.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ There's nothing obvious in what you've shown that would cause this. Do you have any other scripts that might be influencing the camera position? \$\endgroup\$ Commented Jun 3, 2018 at 20:24
  • \$\begingroup\$ @DMGregory not really, those are the only two object in the scene and the only script is the one on the camera I pasted in my question. However I deleted and I did everything back from scratch; now everything is working as expected. \$\endgroup\$ Commented Jun 3, 2018 at 20:33
  • \$\begingroup\$ Hmm when looking at the script component, the variables aren't changing, so I don't think this script is causing the issue... \$\endgroup\$ Commented Jun 3, 2018 at 21:58

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.