Skip to content

Instantly share code, notes, and snippets.

@walterpalladino
Created April 15, 2021 20:23
Show Gist options
  • Select an option

  • Save walterpalladino/19b3541772abd9805956b510d53c5dfd to your computer and use it in GitHub Desktop.

Select an option

Save walterpalladino/19b3541772abd9805956b510d53c5dfd to your computer and use it in GitHub Desktop.
Unity 3D Billboard only facing Y to camera
using UnityEngine;
public class BillboardFacingY : MonoBehaviour
{
void Update()
{
// look at camera...
transform.LookAt(Camera.main.transform.position, -Vector3.up);
// then lock rotation to Y axis only...
transform.localEulerAngles = new Vector3(0,transform.localEulerAngles.y,0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment