Hey guys!
The coder from my project made a Lookat script for a plane to behave like a billboard, but it’s acting kinda strange.
It was working perfectly, the plane was rotating on the Y axis, the problem is that the script needed to be run like this:
GameObject (Parent)
Plane (Child)
And the script was getting the pivot from the GameObject (wich is in the wrong place), so when he changed for it to get the Plane pivot it started working strange, it still followed the player on the Y axis, but the X axis was working too, so when the player got near the plane (wich is bigger than the player itself) it would go up, and I don’t want this kind of behaviour, I just need Y rotation 
using UnityEngine;
using System.Collections;
public class Billboard : MonoBehaviour {
public bool eixoX = true ,eixoY = true ,eixoZ = true;
// Update is called once per frame
void Update ()
{
Camera c = Camera.main;
Vector3 v = c.transform.position - transform.position;
if(!eixoX)
v.x = 0.0f;
if(!eixoY)
v.y = 0.0f;
if(!eixoZ)
v.z = 0.0f;
foreach(Transform t in GetComponentInChildren<Transform>())
{
t.LookAt(c.transform.position - v);
}
}
}
PS: If there’s other ways to apply a Billboard to a simple plane, or transform an alpha texture into a billboard, it would be welcome too!
THANKS A LOT!
Ashk
t.Lookat = new Vector3(0, c.transform.position - v, 0);
try that
I’m getting
Assets/Scripts/Billboard.cs(24,78): error CS1502: The best overloaded method match for `UnityEngine.Vector3.Vector3(float, float, float)’ has some invalid arguments
Assets/Scripts/Billboard.cs(24,78): error CS1503: Argument #2' cannot convert UnityEngine.Vector3’ expression to type `float’
Assets/Scripts/Billboard.cs(24,27): error CS0131: The left-hand side of an assignment must be a variable, a property or an indexer
For the code:
using UnityEngine;
using System.Collections;
public class Billboard : MonoBehaviour {
public bool eixoX = true ,eixoY = true ,eixoZ = true;
// Update is called once per frame
void Update ()
{
Camera c = Camera.main;
Vector3 v = c.transform.position - transform.position;
if(!eixoX)
v.x = 0.0f;
if(!eixoY)
v.y = 0.0f;
if(!eixoZ)
v.z = 0.0f;
foreach(Transform t in GetComponentInChildren<Transform>())
{
t.LookAt= new Vector3(0, c.transform.position - v, 0);
}
}
}
Thanks for the reply 
PS: Sorry if I’m beeing noob, it’s because I’m the Level Designer / Animator and I know just a little about coding. I’d be happy if you guys can explain a little more in depth for me about the code changes that I have to make.
Thanks A LOT!
t.LookAt(new Vector3(0, c.transform.position - v, 0));
t.LookAt is not a variable, it is a function, expecting a Vector3 parameter. You were previously trying to assign it a Vector3.
EDIT: Also, shouldn’t it be c.transform.position**.y** - v?