Spelunx Cavern SDK
 
Loading...
Searching...
No Matches
LookAt.cs
Go to the documentation of this file.
1using UnityEngine;
2
3namespace Spelunx.Vive {
4 public class LookAt : Interaction {
5 [SerializeField, Tooltip("Flip rotation. Enable this if the object is looking the opposite direction")] private bool flipRotation = false;
6
7 void Update() {
8 if (flipRotation) {
9 transform.LookAt(2 * transform.position - target.position);
10 } else {
11 transform.LookAt(target);
12 }
13 }
14 }
15}