Spelunx Cavern SDK
 
Loading...
Searching...
No Matches
FollowInteraction.cs
Go to the documentation of this file.
1using UnityEngine;
2
3namespace Spelunx.Vive {
4 /*
5 * This script copies the movement of the target with an optional offset (x, y, z)
6 * The default is no offset, moving at the same place as the target
7 */
9 [SerializeField, Tooltip("The offset vector from the target position.")] private Vector3 positionOffset = new Vector3(0.0f, 0.0f, 0.0f);
10
11 public Vector3 GetPositionOffset() { return positionOffset; }
12 public void SetPositionOffset(Vector3 positionOffset) { this.positionOffset = positionOffset; }
13
14 private void Update() {
15 if (target == null) return;
16 transform.position = target.position + positionOffset;
17 }
18 }
19}
void SetPositionOffset(Vector3 positionOffset)