Spelunx Cavern SDK
Loading...
Searching...
No Matches
FollowInteraction.cs
Go to the documentation of this file.
1
using
UnityEngine;
2
3
namespace
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
*/
8
public
class
FollowInteraction
:
Interaction
{
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
}
Spelunx.Vive.FollowInteraction
Definition:
FollowInteraction.cs:8
Spelunx.Vive.FollowInteraction.GetPositionOffset
Vector3 GetPositionOffset()
Definition:
FollowInteraction.cs:11
Spelunx.Vive.FollowInteraction.SetPositionOffset
void SetPositionOffset(Vector3 positionOffset)
Definition:
FollowInteraction.cs:12
Spelunx.Vive.Interaction
Definition:
Interaction.cs:4
Spelunx.Vive.Interaction.target
Transform target
Definition:
Interaction.cs:5
Spelunx.Vive
Definition:
CavernInteraction.cs:4
CavernSDK
Packages
com.spelunx.cavern.vive-trackers
Runtime
Scripts
Interactions
FollowInteraction.cs
Generated by
1.9.6