Work Begins on a DeathJam Project

Work Begins on a DeathJam Project

Some Design Hashing happened a little bit after the official start date, and then today I started digging into unity and wrangled up a decent solution for doing billboard style sprites:

This took me a bit to find the best solution on short notice, but I figure it would be helpfull for anyone who wanted to use unity for a more 3D feel without getting into the complications of model assets:

 

This is a C# script that I mostly lifted off the unity wiki, but was slightly modified for better performance, (calls to transform on an object are slightly slower then caching the transform reference before hand and calling from that).

Just drop it onto a sprite and you should be golden for making it always face the camera in a sensible way.

public class billboard : MonoBehaviour {

public Transform m_CameraTransform;

private Transform m_Transform;

// Use this for initialization

void Start () {

if(m_CameraTransform == null)

{

m_CameraTransform = Camera.main.transform;

}

 

m_Transform = transform;

}

 

// Update is called once per frame

void Update () {

m_Transform.LookAt(m_Transform.position + m_CameraTransform.rotation * Vector3.back,

                  m_CameraTransform.rotation * Vector3.up);

}