39 lines
1.4 KiB
C#
39 lines
1.4 KiB
C#
using BlockSpace.Voxels;
|
|
using UnityEngine;
|
|
|
|
[DisallowMultipleComponent]
|
|
public sealed class HandPositionsBehavior : NodeBehavior
|
|
{
|
|
public override void OnGraphUpdate()
|
|
{
|
|
Transform transform = ((VRVoxelBrush.Instance != null) ? VRVoxelBrush.Instance.LeftHandAnchor : null);
|
|
Transform transform2 = ((VRVoxelBrush.Instance != null) ? VRVoxelBrush.Instance.RightHandAnchor : null);
|
|
if (transform != null)
|
|
{
|
|
Vector3 vector = NodePlayerUtility.WorldToVoxelPosition(transform.position);
|
|
SetLocalOutputValueIfChanged("Left X", BSValue.FromNumber(vector.x));
|
|
SetLocalOutputValueIfChanged("Left Y", BSValue.FromNumber(vector.y));
|
|
SetLocalOutputValueIfChanged("Left Z", BSValue.FromNumber(vector.z));
|
|
}
|
|
else
|
|
{
|
|
SetLocalOutputValueIfChanged("Left X", BSValue.None);
|
|
SetLocalOutputValueIfChanged("Left Y", BSValue.None);
|
|
SetLocalOutputValueIfChanged("Left Z", BSValue.None);
|
|
}
|
|
if (transform2 != null)
|
|
{
|
|
Vector3 vector2 = NodePlayerUtility.WorldToVoxelPosition(transform2.position);
|
|
SetLocalOutputValueIfChanged("Right X", BSValue.FromNumber(vector2.x));
|
|
SetLocalOutputValueIfChanged("Right Y", BSValue.FromNumber(vector2.y));
|
|
SetLocalOutputValueIfChanged("Right Z", BSValue.FromNumber(vector2.z));
|
|
}
|
|
else
|
|
{
|
|
SetLocalOutputValueIfChanged("Right X", BSValue.None);
|
|
SetLocalOutputValueIfChanged("Right Y", BSValue.None);
|
|
SetLocalOutputValueIfChanged("Right Z", BSValue.None);
|
|
}
|
|
}
|
|
}
|