Quaternion.LookRotation is inefficient

I have a very simple function that makes things look at other things. It’s mainly used for making flat planes looka that camera. It is however, really inefficient and taxing on the processor. I have lots of these and they’re adding up to quite a lot in the profiler. 0.05 Time ms each. So 20 make 1 Time ms in the profiler. Is there a more efficient way of writing this?

static function lookQuatSet(go, vec){

var rotation : Quaternion = Quaternion.LookRotation(vec - go.transform.position);
go.transform.rotation = rotation;

}

I have a hard time believing 20 calls is taking up 1/16th of your frame but you could use a billboard shader instead to move the work to the GPU.

1 Like