mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-30 15:59:09 +00:00
23 lines
526 B
C#
23 lines
526 B
C#
|
using UnityEngine;
|
|||
|
|
|||
|
namespace SanAndreasUnity.Utilities
|
|||
|
{
|
|||
|
public class FaceTowardsCamera : MonoBehaviour
|
|||
|
{
|
|||
|
public Transform[] transformsToFace;
|
|||
|
|
|||
|
void Update()
|
|||
|
{
|
|||
|
var cam = Camera.current;
|
|||
|
if (cam != null)
|
|||
|
{
|
|||
|
Vector3 f = -cam.transform.forward;
|
|||
|
for (int i = 0; i < this.transformsToFace.Length; i++)
|
|||
|
{
|
|||
|
this.transformsToFace[i].forward = f;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|