mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2025-03-01 13:47:14 +00:00
22 lines
526 B
C#
22 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;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|