clean project

This commit is contained in:
Helar Jaadla
2022-03-07 17:52:41 +02:00
parent a174b45bd2
commit cbeb10ec35
5100 changed files with 837159 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8d635c11ead8ed24ca89687fbcc31264
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,112 @@
/************************************************************************************
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
https://developer.oculus.com/licenses/oculussdk/
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
************************************************************************************/
using Oculus.Interaction.Input;
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.Serialization;
namespace Oculus.Interaction
{
public class ControllerOffset : MonoBehaviour
{
[SerializeField, Interface(typeof(IController))]
private MonoBehaviour _controller;
public IController Controller { get; private set; }
[SerializeField]
private Vector3 _offset;
[SerializeField]
private Quaternion _rotation = Quaternion.identity;
private Pose _cachedPose = Pose.identity;
protected bool _started = false;
protected virtual void Awake()
{
Controller = _controller as IController;
}
protected virtual void Start()
{
this.BeginStart(ref _started);
Assert.IsNotNull(Controller);
this.EndStart(ref _started);
}
protected virtual void OnEnable()
{
if (_started)
{
Controller.ControllerUpdated += HandleControllerUpdated;
}
}
protected virtual void OnDisable()
{
if (_started)
{
Controller.ControllerUpdated -= HandleControllerUpdated;
}
}
private void HandleControllerUpdated()
{
if (Controller.TryGetPose(out Pose rootPose))
{
GetOffset(ref _cachedPose);
_cachedPose.Postmultiply(rootPose);
transform.SetPose(_cachedPose);
}
}
public void GetOffset(ref Pose pose)
{
pose.position = _offset;
pose.rotation = _rotation;
}
public void GetWorldPose(ref Pose pose)
{
pose.position = this.transform.position;
pose.rotation = this.transform.rotation;
}
#region Inject
public void InjectController(IController controller)
{
_controller = controller as MonoBehaviour;
Controller = controller;
}
public void InjectOffset(Vector3 offset)
{
_offset = offset;
}
public void InjectRotation(Quaternion rotation)
{
_rotation = rotation;
}
public void InjectAllControllerOffset(IController controller,
Vector3 offset, Quaternion rotation)
{
InjectController(controller);
InjectOffset(offset);
InjectRotation(rotation);
}
#endregion
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 488896fe86105104a8453d9f173cf62a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,98 @@
/************************************************************************************
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
https://developer.oculus.com/licenses/oculussdk/
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
************************************************************************************/
using Oculus.Interaction.Input;
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.Serialization;
namespace Oculus.Interaction
{
public class ControllerPointerPose : MonoBehaviour, IActiveState
{
[SerializeField, Interface(typeof(IController))]
private MonoBehaviour _controller;
public IController Controller { get; private set; }
[SerializeField]
private Vector3 _offset;
protected bool _started = false;
public bool Active { get; private set; }
protected virtual void Awake()
{
Controller = _controller as IController;
}
protected virtual void Start()
{
this.BeginStart(ref _started);
Assert.IsNotNull(Controller);
this.EndStart(ref _started);
}
protected virtual void OnEnable()
{
if (_started)
{
Controller.ControllerUpdated += HandleControllerUpdated;
}
}
protected virtual void OnDisable()
{
if (_started)
{
Controller.ControllerUpdated -= HandleControllerUpdated;
}
}
private void HandleControllerUpdated()
{
IController controller = Controller;
if (controller.TryGetPointerPose(out Pose pose))
{
pose.position += pose.rotation * _offset;
transform.SetPose(pose);
Active = true;
}
else
{
Active = false;
}
}
#region Inject
public void InjectController(IController controller)
{
_controller = controller as MonoBehaviour;
Controller = controller;
}
public void InjectOffset(Vector3 offset)
{
_offset = offset;
}
public void InjectAllHandPointerPose(IController controller,
Vector3 offset)
{
InjectController(controller);
InjectOffset(offset);
}
#endregion
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 438e12c9002f2c8489c81a2d3472b18d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,117 @@
/************************************************************************************
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
https://developer.oculus.com/licenses/oculussdk/
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
************************************************************************************/
using Oculus.Interaction.Input;
using System;
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.Serialization;
namespace Oculus.Interaction
{
public class ControllerSelector : MonoBehaviour, ISelector
{
public enum ControllerSelectorLogicOperator
{
Any = 0,
All = 1
}
[SerializeField, Interface(typeof(IController))]
private MonoBehaviour _controller;
[SerializeField]
private ControllerButtonUsage _controllerButtonUsage;
[SerializeField]
private ControllerSelectorLogicOperator _requireButtonUsages =
ControllerSelectorLogicOperator.Any;
#region Properties
public ControllerButtonUsage ControllerButtonUsage
{
get
{
return _controllerButtonUsage;
}
set
{
_controllerButtonUsage = value;
}
}
public ControllerSelectorLogicOperator RequireButtonUsages
{
get
{
return _requireButtonUsages;
}
set
{
_requireButtonUsages = value;
}
}
#endregion
public IController Controller { get; private set; }
public event Action WhenSelected = delegate { };
public event Action WhenUnselected = delegate { };
private bool _selected;
protected virtual void Awake()
{
Controller = _controller as IController;
}
protected virtual void Start()
{
Assert.IsNotNull(Controller);
}
protected virtual void Update()
{
bool selected = _requireButtonUsages == ControllerSelectorLogicOperator.All
? Controller.IsButtonUsageAllActive(_controllerButtonUsage)
: Controller.IsButtonUsageAnyActive(_controllerButtonUsage);
if (selected)
{
if (_selected) return;
_selected = true;
WhenSelected();
}
else
{
if (!_selected) return;
_selected = false;
WhenUnselected();
}
}
#region Inject
public void InjectAllControllerSelector(IController controller)
{
InjectController(controller);
}
public void InjectController(IController controller)
{
_controller = controller as MonoBehaviour;;
Controller = controller;
}
#endregion
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6d2303af7d4c7114681742031c4a0ac6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: dc4c3bb0ec13df74dbe8e912d33cadaf
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,133 @@
/************************************************************************************
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
https://developer.oculus.com/licenses/oculussdk/
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
************************************************************************************/
using Oculus.Interaction.Input;
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.Serialization;
namespace Oculus.Interaction
{
public class HandJoint : MonoBehaviour
{
[SerializeField, Interface(typeof(IHand))]
private MonoBehaviour _hand;
public IHand Hand { get; private set; }
[FormerlySerializedAs("_jointId")]
[SerializeField]
private HandJointId _handJointId;
[FormerlySerializedAs("_offset")]
[SerializeField]
private Vector3 _localPositionOffset;
[SerializeField]
private Quaternion _rotationOffset = Quaternion.identity;
#region Properties
public HandJointId HandJointId
{
get
{
return _handJointId;
}
set
{
_handJointId = value;
}
}
public Vector3 LocalPositionOffset
{
get
{
return _localPositionOffset;
}
set
{
_localPositionOffset = value;
}
}
public Quaternion RotationOffset
{
get
{
return _rotationOffset;
}
set
{
_rotationOffset = value;
}
}
#endregion
protected bool _started = false;
protected virtual void Awake()
{
Hand = _hand as IHand;
}
protected virtual void Start()
{
this.BeginStart(ref _started);
Assert.IsNotNull(Hand);
this.EndStart(ref _started);
}
protected virtual void OnEnable()
{
if (_started)
{
Hand.HandUpdated += HandleHandUpdated;
}
}
protected virtual void OnDisable()
{
if (_started)
{
Hand.HandUpdated -= HandleHandUpdated;
}
}
private void HandleHandUpdated()
{
if (!Hand.GetJointPose(_handJointId, out Pose pose)) return;
Vector3 positionOffsetWithHandedness =
(Hand.Handedness == Handedness.Left ? -1f : 1f) * _localPositionOffset;
pose.position += _rotationOffset * pose.rotation *
positionOffsetWithHandedness * Hand.Scale;
transform.SetPose(pose);
}
#region Inject
public void InjectAllHandJoint(IHand hand)
{
InjectHand(hand);
}
public void InjectHand(IHand hand)
{
_hand = hand as MonoBehaviour;
Hand = hand;
}
#endregion;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: abee63302fdc2bb4f80efe129df0a723
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,92 @@
/************************************************************************************
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
https://developer.oculus.com/licenses/oculussdk/
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
************************************************************************************/
using Oculus.Interaction.Input;
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.Serialization;
namespace Oculus.Interaction
{
public class HandPointerPose : MonoBehaviour, IActiveState
{
[SerializeField, Interface(typeof(IHand))]
private MonoBehaviour _hand;
public IHand Hand { get; private set; }
[SerializeField]
private Vector3 _offset;
public bool Active => Hand.IsPointerPoseValid;
protected bool _started = false;
protected virtual void Awake()
{
Hand = _hand as IHand;
}
protected virtual void Start()
{
this.BeginStart(ref _started);
Assert.IsNotNull(Hand);
this.EndStart(ref _started);
}
protected virtual void OnEnable()
{
if (_started)
{
Hand.HandUpdated += HandleHandUpdated;
}
}
protected virtual void OnDisable()
{
if (_started)
{
Hand.HandUpdated -= HandleHandUpdated;
}
}
private void HandleHandUpdated()
{
if (Hand.GetPointerPose(out Pose pointerPose))
{
pointerPose.position += pointerPose.rotation * _offset;
transform.SetPose(pointerPose);
}
}
#region Inject
public void InjectAllHandPointerPose(IHand hand,
Vector3 offset)
{
InjectHand(hand);
InjectOffset(offset);
}
public void InjectHand(IHand hand)
{
_hand = hand as MonoBehaviour;
Hand = hand;
}
public void InjectOffset(Vector3 offset)
{
_offset = offset;
}
#endregion
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 417817ee9b785e341b31ce731f028317
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,61 @@
/************************************************************************************
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
https://developer.oculus.com/licenses/oculussdk/
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
************************************************************************************/
using Oculus.Interaction.Input;
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.Serialization;
namespace Oculus.Interaction
{
public class HandTransformScaler : MonoBehaviour
{
[SerializeField, Interface(typeof(IHand))]
private MonoBehaviour _hand;
public IHand Hand { get; private set; }
protected bool _started = false;
protected virtual void Awake()
{
Hand = _hand as IHand;
}
protected virtual void Start()
{
this.BeginStart(ref _started);
Assert.IsNotNull(Hand);
this.EndStart(ref _started);
}
protected virtual void OnEnable()
{
if (_started)
{
Hand.HandUpdated += HandleHandUpdated;
}
}
protected virtual void OnDisable()
{
if (_started)
{
Hand.HandUpdated -= HandleHandUpdated;
}
}
private void HandleHandUpdated()
{
transform.localScale = Vector3.one * Hand.Scale;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5a52cc62b98662b4e9ac356027b2b070
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,128 @@
/************************************************************************************
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
https://developer.oculus.com/licenses/oculussdk/
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
************************************************************************************/
using Oculus.Interaction.Input;
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.Serialization;
namespace Oculus.Interaction
{
/// <summary>
/// Specifies a position and rotation offset from the wrist of the given hand
/// </summary>
public class HandWristOffset : MonoBehaviour
{
[SerializeField, Interface(typeof(IHand))]
private MonoBehaviour _hand;
public IHand Hand { get; private set; }
[SerializeField]
private Vector3 _offset;
[SerializeField]
private Quaternion _rotation = Quaternion.identity;
private Pose _cachedPose = Pose.identity;
private static readonly Quaternion LEFT_MIRROR_ROTATION = Quaternion.Euler(180f, 0f, 0f);
protected bool _started = false;
protected virtual void Awake()
{
Hand = _hand as IHand;
}
protected virtual void Start()
{
this.BeginStart(ref _started);
Assert.IsNotNull(Hand);
this.EndStart(ref _started);
}
protected virtual void OnEnable()
{
if (_started)
{
Hand.HandUpdated += HandleHandUpdated;
}
}
protected virtual void OnDisable()
{
if (_started)
{
Hand.HandUpdated -= HandleHandUpdated;
}
}
private void HandleHandUpdated()
{
if (Hand.GetRootPose(out Pose rootPose))
{
GetOffset(ref _cachedPose);
_cachedPose.Postmultiply(rootPose);
transform.SetPose(_cachedPose);
}
}
public void GetOffset(ref Pose pose)
{
if (!_started)
{
return;
}
if (Hand.Handedness == Handedness.Left)
{
pose.position = -_offset * Hand.Scale;
pose.rotation = _rotation * LEFT_MIRROR_ROTATION;
}
else
{
pose.position = _offset * Hand.Scale;
pose.rotation = _rotation;
}
}
public void GetWorldPose(ref Pose pose)
{
pose.position = this.transform.position;
pose.rotation = this.transform.rotation;
}
#region Inject
public void InjectHand(IHand hand)
{
_hand = hand as MonoBehaviour;
Hand = hand;
}
public void InjectOffset(Vector3 offset)
{
_offset = offset;
}
public void InjectRotation(Quaternion rotation)
{
_rotation = rotation;
}
public void InjectAllHandWristOffset(IHand hand,
Vector3 offset, Quaternion rotation)
{
InjectHand(hand);
InjectOffset(offset);
InjectRotation(rotation);
}
#endregion
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d61ea23b9fd13af40afe326bb23ac1cd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,94 @@
/************************************************************************************
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
https://developer.oculus.com/licenses/oculussdk/
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
************************************************************************************/
using Oculus.Interaction.Input;
using System;
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.Serialization;
namespace Oculus.Interaction
{
public class IndexPinchSelector : MonoBehaviour, ISelector
{
[SerializeField, Interface(typeof(IHand))]
private MonoBehaviour _hand;
public IHand Hand { get; private set; }
private bool _isIndexFingerPinching;
public event Action WhenSelected = delegate { };
public event Action WhenUnselected = delegate { };
protected bool _started = false;
protected virtual void Awake()
{
Hand = _hand as IHand;
}
protected virtual void Start()
{
this.BeginStart(ref _started);
Assert.IsNotNull(Hand);
this.EndStart(ref _started);
}
protected virtual void OnEnable()
{
if (_started)
{
Hand.HandUpdated += HandleHandUpdated;
}
}
protected virtual void OnDisable()
{
if (_started)
{
Hand.HandUpdated -= HandleHandUpdated;
}
}
private void HandleHandUpdated()
{
var prevPinching = _isIndexFingerPinching;
_isIndexFingerPinching = Hand.GetIndexFingerIsPinching();
if (prevPinching != _isIndexFingerPinching)
{
if (_isIndexFingerPinching)
{
WhenSelected();
}
else
{
WhenUnselected();
}
}
}
#region Inject
public void InjectAllIndexPinchSelector(IHand hand)
{
InjectHand(hand);
}
public void InjectHand(IHand hand)
{
_hand = hand as MonoBehaviour;
Hand = hand;
}
#endregion
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1b6b944de90aa9047929c54d143ff2da
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3993c66e74c321e4db0acd218a71008a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,64 @@
/************************************************************************************
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
https://developer.oculus.com/licenses/oculussdk/
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language governing
permissions and limitations under the License.
************************************************************************************/
using System;
using UnityEngine;
namespace Oculus.Interaction
{
/// <summary>
/// This Virtual Selector can provide interactions with a sample selector
/// that can be toggled from within the Unity insepctor using the HandleSelected Flag
/// </summary>
public class VirtualSelector : MonoBehaviour, ISelector
{
[SerializeField]
private bool _selectFlag;
public event Action WhenSelected = delegate { };
public event Action WhenUnselected = delegate { };
private bool _currentlySelected;
public void Select()
{
_selectFlag = true;
UpdateSelection();
}
public void Unselect()
{
_selectFlag = false;
UpdateSelection();
}
protected virtual void OnValidate()
{
UpdateSelection();
}
protected void UpdateSelection()
{
if (_currentlySelected != _selectFlag)
{
_currentlySelected = _selectFlag;
if (_currentlySelected)
{
WhenSelected();
}
else
{
WhenUnselected();
}
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 42bba106679662e4b925dca314de22c2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: