using BlockSpace.Voxels; using UnityEngine; [DisallowMultipleComponent] public sealed class HandRotationsBehavior : 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 eulerAngles = transform.rotation.eulerAngles; SetLocalOutputValueIfChanged("Left Yaw", BSValue.FromNumber(eulerAngles.y)); SetLocalOutputValueIfChanged("Left Pitch", BSValue.FromNumber(eulerAngles.x)); SetLocalOutputValueIfChanged("Left Roll", BSValue.FromNumber(eulerAngles.z)); } else { SetLocalOutputValueIfChanged("Left Yaw", BSValue.None); SetLocalOutputValueIfChanged("Left Pitch", BSValue.None); SetLocalOutputValueIfChanged("Left Roll", BSValue.None); } if (transform2 != null) { Vector3 eulerAngles2 = transform2.rotation.eulerAngles; SetLocalOutputValueIfChanged("Right Yaw", BSValue.FromNumber(eulerAngles2.y)); SetLocalOutputValueIfChanged("Right Pitch", BSValue.FromNumber(eulerAngles2.x)); SetLocalOutputValueIfChanged("Right Roll", BSValue.FromNumber(eulerAngles2.z)); } else { SetLocalOutputValueIfChanged("Right Yaw", BSValue.None); SetLocalOutputValueIfChanged("Right Pitch", BSValue.None); SetLocalOutputValueIfChanged("Right Roll", BSValue.None); } } }