- Home /
When moving camera I like my circle Plane look at cam.
using UnityEngine;
using System.Collections;
public class LookAtCamera : MonoBehaviour {
public Transform target;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
// transform.LookAt(target.transform.position, Vector3.zero); // tried this, only looks at sides
// transform.LookAt(target); // tried this, also only looks at sides
transform.LookAt(transform.position+Camera.main.transform.rotation*Vector3.up); // tried this and it look at camera but it does not update and continue to look at camera while moving.
// transform.LookAt(target.transform.position+Camera.main.transform.rotation*Vector3.up); also tried this & only looks at sides
}
}
When I view inside a planet I have a circular sphere (the mantle) which I like for it to point towards the camera, this way when I get too close to the planet I don't happen to look through the planet so I added a spherical core and a circular plane for the mantle.
I looked at all the look at plane unity help, and none of them worked, some worked once and did not update after that, others just kept looking at the sides. I posted some examples in the script that I found online which did not work for me. I just need the Mantle to look at the camera, the camera will not be a child since it will fly from planet to planet. As some suggested make it a parent.
Your answer
Follow this Question
Related Questions
look at script for a plane and what I might be doing wrong 2 Answers
Ease in transform.LookAt() - keep other target within camera boundaries 1 Answer
Arial camera get selected point 2 Answers
Change the object the camera looks at? 1 Answer
Make the terrain ignore Raycast if in between Camera and Player? 1 Answer