- Home /
Problem with a Billboard script
Hi,
I found a script to make an object always look at the camera :
using UnityEngine;
using System.Collections;
public class CameraFacingBillboard : MonoBehaviour
{
public Camera m_Camera;
void Update()
{
transform.LookAt(transform.position + m_Camera.transform.rotation * Vector3.back,
m_Camera.transform.rotation * Vector3.up);
}
}
But I don't really understand the things inside the transform.LookAt. I mean, I know what it stands for (Object to point towards, Vector specifying the upward direction), but I don't know why this values are selected.
Thus, i have a problem I don' t understand either. The rotation center is not located at the center of the object anymore. When the camera is rotating on its axis, the object seems to rotate around another axis.
Could anybody explain me the values taken in the script? How can I make sure my object stays at his original position?
Thank you for helping me :)
Your answer
Follow this Question
Related Questions
Billboard shader does not support rotation of object 0 Answers
Stop Billboard Texture Rotation in Triplanar Shader 0 Answers
Flip over an object (smooth transition) 3 Answers
Cloud System Billboard (Look At) Script Z axis lock? 1 Answer
Is the trail emitted by the Trail Renderer "billboard"? 1 Answer