Last active
January 18, 2023 08:07
-
-
Save klaszlo8207/09cf0c72655b9d3ddb574e8e8686cada to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
namespace _MyScripts.Utils | |
{ | |
public static class PlaneUtils | |
{ | |
private static Camera _camera; | |
public static void PlaneRotateToCamera(GameObject go, float x, float y, float z) | |
{ | |
if (_camera == null) _camera = Camera.main; | |
var direction = _camera.transform.position - go.transform.position; | |
go.transform.rotation = Quaternion.LookRotation(direction.normalized) * Quaternion.Euler(x, y, z); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment