diff --git a/.gitignore b/.gitignore
index e31b6a51..db9aeb7e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,3 +19,11 @@
# Unity3D Generated File On Crash Reports
sysinfo.txt
+
+Assets/Plugins.meta
+Assets/Plugins/
+Assets/OVR.meta
+Assets/OVR/
+Assets/SteamVR.meta
+Assets/SteamVR/
+
diff --git a/Assets/NewtonVR/NVRButtonInput.cs b/Assets/NewtonVR/NVRButtonInput.cs
index 76eb8552..960365f0 100644
--- a/Assets/NewtonVR/NVRButtonInput.cs
+++ b/Assets/NewtonVR/NVRButtonInput.cs
@@ -14,7 +14,7 @@ public bool PressDown
{
if (PressDownExpired)
{
- PressDownCached = InputDevice.GetPressDown(NVRbutton);
+ PressDownCached = (InputDevice != null) ? InputDevice.GetPressDown(NVRbutton) : false;
PressDownExpired = false;
}
return PressDownCached;
@@ -22,7 +22,7 @@ public bool PressDown
}
private bool PressDownCached;
- private bool PressDownExpired = false;
+ private bool PressDownExpired = true;
/// Is true ONLY on the frame that the button is released after being pressed down
public bool PressUp
@@ -31,7 +31,7 @@ public bool PressUp
{
if (PressUpExpired)
{
- PressUpCached = InputDevice.GetPressUp(NVRbutton);
+ PressUpCached = (InputDevice != null) ? InputDevice.GetPressUp(NVRbutton) : false;
PressUpExpired = false;
}
return PressUpCached;
@@ -39,7 +39,7 @@ public bool PressUp
}
private bool PressUpCached;
- private bool PressUpExpired = false;
+ private bool PressUpExpired = true;
/// Is true WHENEVER the button is pressed down
public bool IsPressed
@@ -48,7 +48,7 @@ public bool IsPressed
{
if (IsPressedExpired)
{
- IsPressedCached = InputDevice.GetPress(NVRbutton);
+ IsPressedCached = (InputDevice != null) ? InputDevice.GetPress(NVRbutton) : false;
IsPressedExpired = false;
}
return IsPressedCached;
@@ -56,7 +56,7 @@ public bool IsPressed
}
private bool IsPressedCached;
- private bool IsPressedExpired = false;
+ private bool IsPressedExpired = true;
/// Is true ONLY on the frame that the button is first touched
public bool TouchDown
@@ -65,7 +65,7 @@ public bool TouchDown
{
if (TouchDownExpired)
{
- TouchDownCached = InputDevice.GetTouchDown(NVRbutton);
+ TouchDownCached = (InputDevice != null) ? InputDevice.GetTouchDown(NVRbutton) : false;
TouchDownExpired = false;
}
return TouchDownCached;
@@ -73,7 +73,7 @@ public bool TouchDown
}
private bool TouchDownCached;
- private bool TouchDownExpired = false;
+ private bool TouchDownExpired = true;
/// Is true ONLY on the frame that the button is released after being touched
public bool TouchUp
@@ -82,7 +82,7 @@ public bool TouchUp
{
if (TouchUpExpired)
{
- TouchUpCached = InputDevice.GetTouchUp(NVRbutton);
+ TouchUpCached = (InputDevice != null) ? InputDevice.GetTouchUp(NVRbutton) : false;
TouchUpExpired = false;
}
return TouchUpCached;
@@ -90,7 +90,7 @@ public bool TouchUp
}
private bool TouchUpCached;
- private bool TouchUpExpired = false;
+ private bool TouchUpExpired = true;
/// Is true WHENEVER the button is being touched
public bool IsTouched
@@ -99,7 +99,7 @@ public bool IsTouched
{
if (IsTouchedExpired)
{
- IsTouchedCached = InputDevice.GetTouch(NVRbutton);
+ IsTouchedCached = (InputDevice != null) ? InputDevice.GetTouch(NVRbutton) : false;
IsTouchedExpired = false;
}
return IsTouchedCached;
@@ -107,7 +107,7 @@ public bool IsTouched
}
private bool IsTouchedCached;
- private bool IsTouchedExpired = false;
+ private bool IsTouchedExpired = true;
/// Is true ONLY on the frame that the button is first near touched
public bool NearTouchDown
@@ -116,7 +116,7 @@ public bool NearTouchDown
{
if (NearTouchDownExpired)
{
- NearTouchDownCached = InputDevice.GetNearTouchDown(NVRbutton);
+ NearTouchDownCached = (InputDevice != null) ? InputDevice.GetNearTouchDown(NVRbutton) : false;
NearTouchDownExpired = false;
}
return NearTouchDownCached;
@@ -124,7 +124,7 @@ public bool NearTouchDown
}
private bool NearTouchDownCached;
- private bool NearTouchDownExpired = false;
+ private bool NearTouchDownExpired = true;
/// Is true ONLY on the frame that the button is released after being near touched
public bool NearTouchUp
@@ -133,7 +133,7 @@ public bool NearTouchUp
{
if (NearTouchUpExpired)
{
- NearTouchUpCached = InputDevice.GetNearTouchUp(NVRbutton);
+ NearTouchUpCached = (InputDevice != null) ? InputDevice.GetNearTouchUp(NVRbutton) : false;
NearTouchUpExpired = false;
}
return NearTouchUpCached;
@@ -141,7 +141,7 @@ public bool NearTouchUp
}
private bool NearTouchUpCached;
- private bool NearTouchUpExpired = false;
+ private bool NearTouchUpExpired = true;
/// Is true WHENEVER the button is near being touched
public bool IsNearTouched
@@ -150,7 +150,7 @@ public bool IsNearTouched
{
if (IsNearTouchedExpired)
{
- IsNearTouchedCached = InputDevice.GetNearTouch(NVRbutton);
+ IsNearTouchedCached = (InputDevice != null) ? InputDevice.GetNearTouch(NVRbutton) : false;
IsNearTouchedExpired = false;
}
return IsNearTouchedCached;
@@ -158,7 +158,7 @@ public bool IsNearTouched
}
private bool IsNearTouchedCached;
- private bool IsNearTouchedExpired = false;
+ private bool IsNearTouchedExpired = true;
/// x,y axis generally for the touchpad. trigger uses x
public Vector2 Axis
@@ -167,7 +167,7 @@ public Vector2 Axis
{
if (AxisExpired)
{
- AxisCached = InputDevice.GetAxis2D(NVRbutton);
+ AxisCached = (InputDevice != null) ? InputDevice.GetAxis2D(NVRbutton) : Vector2.zero;
AxisExpired = false;
}
return AxisCached;
@@ -175,7 +175,7 @@ public Vector2 Axis
}
private Vector2 AxisCached;
- private bool AxisExpired = false;
+ private bool AxisExpired = true;
/// x axis from Axis
public float SingleAxis
@@ -184,7 +184,7 @@ public float SingleAxis
{
if (SingleAxisExpired)
{
- SingleAxisCached = InputDevice.GetAxis1D(NVRbutton);
+ SingleAxisCached = (InputDevice != null) ? InputDevice.GetAxis1D(NVRbutton) : 0f;
SingleAxisExpired = false;
}
return SingleAxisCached;
@@ -192,7 +192,7 @@ public float SingleAxis
}
private float SingleAxisCached;
- private bool SingleAxisExpired = false;
+ private bool SingleAxisExpired = true;
private NVRInputDevice InputDevice;
private NVRButtons NVRbutton;
diff --git a/Assets/NewtonVR/NVRHand.cs b/Assets/NewtonVR/NVRHand.cs
index 88ca6a84..ff41ccbe 100644
--- a/Assets/NewtonVR/NVRHand.cs
+++ b/Assets/NewtonVR/NVRHand.cs
@@ -40,13 +40,13 @@ public class NVRHand : MonoBehaviour
[HideInInspector]
public GameObject CustomPhysicalColliders;
- private VisibilityLevel CurrentVisibility = VisibilityLevel.Visible;
- private bool VisibilityLocked = false;
+ protected VisibilityLevel CurrentVisibility = VisibilityLevel.Visible;
+ protected bool VisibilityLocked = false;
[HideInInspector]
public HandState CurrentHandState = HandState.Uninitialized;
- private Dictionary> CurrentlyHoveringOver;
+ protected Dictionary> CurrentlyHoveringOver;
public NVRInteractable CurrentlyInteracting;
@@ -55,22 +55,24 @@ public class NVRInteractableEvent : UnityEvent { }
public NVRInteractableEvent OnBeginInteraction = new NVRInteractableEvent();
public NVRInteractableEvent OnEndInteraction = new NVRInteractableEvent();
+ public NVRInteractableEvent OnBeginUseInteraction = new NVRInteractableEvent ();
+ public NVRInteractableEvent OnEndUseInteraction = new NVRInteractableEvent ();
- private int EstimationSampleIndex;
- private Vector3[] LastPositions;
- private Quaternion[] LastRotations;
- private float[] LastDeltas;
- private int EstimationSamples = 5;
+ protected int EstimationSampleIndex;
+ protected Vector3[] LastPositions;
+ protected Quaternion[] LastRotations;
+ protected float[] LastDeltas;
+ protected int EstimationSamples = 5;
[HideInInspector]
public NVRPhysicalController PhysicalController;
- private Collider[] GhostColliders;
- private Renderer[] GhostRenderers;
+ protected Collider[] GhostColliders;
+ protected Renderer[] GhostRenderers;
- private NVRInputDevice InputDevice;
+ protected NVRInputDevice InputDevice;
- private GameObject RenderModel;
+ protected GameObject RenderModel;
public bool IsHovering
{
@@ -356,7 +358,7 @@ protected void UpdateInteractions()
}
}
- private void UpdateVisibilityAndColliders()
+ protected void UpdateVisibilityAndColliders()
{
if (Player.PhysicalHands == true)
{
@@ -590,7 +592,7 @@ public virtual void EndInteraction(NVRInteractable item)
}
}
- private bool PickupClosest()
+ protected bool PickupClosest()
{
NVRInteractable closest = null;
float closestDistance = float.MaxValue;
@@ -601,6 +603,14 @@ private bool PickupClosest()
{
if (hovering.Key == null)
continue;
+
+ if (!hovering.Key.gameObject.activeInHierarchy)
+ continue;
+
+ var itemColliders = hovering.Value;
+
+ itemColliders.Where (item => !item.Key.gameObject.activeInHierarchy).ToList ().ForEach (item => itemColliders.Remove (item.Key));
+
float distance = Vector3.Distance(collider.transform.position, hovering.Key.transform.position);
if (distance < closestDistance)
@@ -621,12 +631,45 @@ private bool PickupClosest()
return false;
}
}
+
+ protected bool PickupByName(string withName)
+ {
+ NVRInteractable closest = null;
+ float closestDistance = float.MaxValue;
+
+
+ foreach (var hovering in CurrentlyHoveringOver)
+ {
+ if (hovering.Key == null)
+ continue;
+
+ float distance = Vector3.Distance(this.transform.position, hovering.Key.transform.position);
+ if (distance < closestDistance && hovering.Key.name==withName)
+ {
+ closestDistance = distance;
+ closest = hovering.Key;
+ }
+ }
+
+ if (closest != null)
+ {
+ BeginInteraction(closest);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
protected virtual void OnTriggerEnter(Collider collider)
{
NVRInteractable interactable = NVRInteractables.GetInteractable(collider);
if (interactable == null || interactable.enabled == false)
return;
+
+ if (CurrentlyHoveringOver == null)
+ CurrentlyHoveringOver = new Dictionary> ();
if (CurrentlyHoveringOver.ContainsKey(interactable) == false)
CurrentlyHoveringOver[interactable] = new Dictionary();
@@ -772,7 +815,7 @@ protected void InitializeRenderModel()
}
}
- public void Initialize()
+ public virtual void Initialize()
{
Rigidbody = this.GetComponent();
if (Rigidbody == null)
@@ -879,4 +922,4 @@ public enum InterationStyle
Toggle,
ByScript,
}
-}
\ No newline at end of file
+}
diff --git a/Assets/NewtonVR/NVRHandedInteractableItem.cs b/Assets/NewtonVR/NVRHandedInteractableItem.cs
new file mode 100644
index 00000000..df05d97f
--- /dev/null
+++ b/Assets/NewtonVR/NVRHandedInteractableItem.cs
@@ -0,0 +1,26 @@
+using UnityEngine;
+using System.Collections;
+using NewtonVR;
+
+public class NVRHandedInteractableItem : NVRInteractableItem
+{
+ [SerializeField]
+ Transform LeftHandInteractionPoint;
+
+ [SerializeField]
+ Transform RightHandInteractionPoint;
+
+ public override void BeginInteraction (NVRHand hand)
+ {
+ if (hand.IsLeft)
+ {
+ InteractionPoint = LeftHandInteractionPoint;
+ }
+ else
+ {
+ InteractionPoint = RightHandInteractionPoint;
+ }
+
+ base.BeginInteraction (hand);
+ }
+}
\ No newline at end of file
diff --git a/Assets/NewtonVR/NVRHandedInteractableItem.cs.meta b/Assets/NewtonVR/NVRHandedInteractableItem.cs.meta
new file mode 100644
index 00000000..3fec7674
--- /dev/null
+++ b/Assets/NewtonVR/NVRHandedInteractableItem.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: e437aa8a24f2b1b4d8e42563c9e9bc66
+timeCreated: 1491508195
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/NewtonVR/NVRInteractable.cs b/Assets/NewtonVR/NVRInteractable.cs
index 517f43dd..3c111293 100644
--- a/Assets/NewtonVR/NVRInteractable.cs
+++ b/Assets/NewtonVR/NVRInteractable.cs
@@ -1,208 +1,218 @@
-using UnityEngine;
-using System.Collections;
-using System.Collections.Generic;
-
-namespace NewtonVR
-{
- public abstract class NVRInteractable : MonoBehaviour
- {
- public Rigidbody Rigidbody;
-
- public bool CanAttach = true;
-
- public bool AllowTwoHanded = false;
-
- public bool DisableKinematicOnAttach = true;
- public bool EnableKinematicOnDetach = false;
- public float DropDistance = 1;
-
- public bool EnableGravityOnDetach = true;
-
- public List AttachedHands = new List();
- public NVRHand AttachedHand
- {
- get
- {
- if (AttachedHands.Count == 0)
- return null;
-
- return AttachedHands[0];
- }
- }
-
- protected Collider[] Colliders = new Collider[0];
- protected Vector3 ClosestHeldPoint;
-
-
-
- public virtual bool IsAttached
- {
- get
- {
- return AttachedHand != null;
- }
- }
-
- protected virtual void Awake()
- {
- if (Rigidbody == null)
- Rigidbody = this.GetComponent();
-
- if (Rigidbody == null)
- {
- Debug.LogError("There is no rigidbody attached to this interactable.");
- }
-
- }
-
- protected virtual void Start()
- {
- UpdateColliders();
- }
-
- public virtual void ResetInteractable()
- {
- Awake();
- Start();
- AttachedHands.Clear();
- }
-
- public virtual void UpdateColliders()
- {
- Colliders = this.GetComponentsInChildren();
- NVRInteractables.Register(this, Colliders);
- }
-
- protected virtual bool CheckForDrop()
- {
-
- for (int handIndex = 0; handIndex < AttachedHands.Count; handIndex++)
- {
- float shortestDistance = float.MaxValue;
- NVRHand hand = AttachedHands[handIndex];
- for (int index = 0; index < Colliders.Length; index++)
- {
- //todo: this does not do what I think it does.
- Vector3 closest = Colliders[index].ClosestPointOnBounds(hand.transform.position);
- float distance = Vector3.Distance(hand.transform.position, closest);
-
- if (distance < shortestDistance)
- {
- shortestDistance = distance;
- ClosestHeldPoint = closest;
- }
- }
-
- if (DropDistance != -1 && hand.CurrentInteractionStyle != InterationStyle.ByScript && shortestDistance > DropDistance)
- {
- DroppedBecauseOfDistance(hand);
-
- if (IsAttached == false)
- {
- return true;
- }
- }
- }
-
- return false;
- }
-
- protected virtual void Update()
- {
- }
-
- public virtual void BeginInteraction(NVRHand hand)
- {
- AttachedHands.Add(hand);
-
- if (DisableKinematicOnAttach == true)
- {
- Rigidbody.isKinematic = false;
- }
- }
-
- public virtual void InteractingUpdate(NVRHand hand)
- {
- if (hand.UseButtonUp == true)
- {
- UseButtonUp();
- }
-
- if (hand.UseButtonDown == true)
- {
- UseButtonDown();
- }
- }
-
- public virtual void HoveringUpdate(NVRHand hand, float forTime)
- {
-
- }
-
- public void ForceDetach(NVRHand hand = null)
- {
- if (hand != null)
- {
- hand.EndInteraction(this);
- this.EndInteraction(hand); //hand should call this in most cases, but rarely hand / item gets disconnected on force detach
- }
- else
- {
- for (int handIndex = (AttachedHands.Count-1); handIndex >= 0; handIndex--)
- {
- NVRHand detaching = AttachedHands[handIndex];
- detaching.EndInteraction(this);
- this.EndInteraction(detaching);
- }
- }
- }
-
- public virtual void EndInteraction(NVRHand hand)
- {
- AttachedHands.Remove(hand);
- ClosestHeldPoint = Vector3.zero;
-
- if (EnableKinematicOnDetach == true)
- {
- Rigidbody.isKinematic = true;
- }
-
- if (EnableGravityOnDetach == true)
- {
- Rigidbody.useGravity = true;
- }
- }
-
- protected virtual void DroppedBecauseOfDistance(NVRHand hand)
- {
- hand.EndInteraction(this);
- }
-
- public virtual void UseButtonUp()
- {
-
- }
-
- public virtual void UseButtonDown()
- {
-
- }
-
-
- public virtual void AddExternalVelocity(Vector3 velocity)
- {
- Rigidbody.AddForce(velocity, ForceMode.VelocityChange);
- }
-
- public virtual void AddExternalAngularVelocity(Vector3 angularVelocity)
- {
- Rigidbody.AddTorque(angularVelocity, ForceMode.VelocityChange);
- }
-
- protected virtual void OnDestroy()
- {
- ForceDetach();
- NVRInteractables.Deregister(this);
- }
- }
-}
+using UnityEngine;
+using System.Collections;
+using System.Collections.Generic;
+
+namespace NewtonVR
+{
+ public abstract class NVRInteractable : MonoBehaviour
+ {
+ public Rigidbody Rigidbody;
+
+ public bool CanAttach = true;
+
+ public bool AllowTwoHanded = false;
+
+ public bool DisableKinematicOnAttach = true;
+ public bool EnableKinematicOnDetach = false;
+ public float DropDistance = 1;
+
+ public bool EnableGravityOnDetach = true;
+
+ public List AttachedHands = new List();
+ public NVRHand AttachedHand
+ {
+ get
+ {
+ if (AttachedHands.Count == 0)
+ return null;
+
+ return AttachedHands[0];
+ }
+ }
+
+ protected Collider[] Colliders = new Collider[0];
+ protected Vector3 ClosestHeldPoint;
+
+
+
+ public virtual bool IsAttached
+ {
+ get
+ {
+ return AttachedHand != null;
+ }
+ }
+
+ protected virtual void Awake()
+ {
+ if (Rigidbody == null)
+ Rigidbody = this.GetComponent();
+
+ if (Rigidbody == null)
+ {
+ Debug.LogError("There is no rigidbody attached to this interactable.");
+ }
+
+ }
+
+ protected virtual void Start()
+ {
+ UpdateColliders();
+ }
+
+ public virtual void ResetInteractable()
+ {
+ Awake();
+ Start();
+ AttachedHands.Clear();
+ }
+
+ public virtual void UpdateColliders()
+ {
+ Colliders = this.GetComponentsInChildren();
+ NVRInteractables.Register(this, Colliders);
+ }
+
+ protected virtual bool CheckForDrop()
+ {
+
+ for (int handIndex = 0; handIndex < AttachedHands.Count; handIndex++)
+ {
+ float shortestDistance = float.MaxValue;
+ NVRHand hand = AttachedHands[handIndex];
+ for (int index = 0; index < Colliders.Length; index++)
+ {
+ //todo: this does not do what I think it does.
+ Vector3 closest = Colliders[index].ClosestPointOnBounds(hand.transform.position);
+ float distance = Vector3.Distance(hand.transform.position, closest);
+
+ if (distance < shortestDistance)
+ {
+ shortestDistance = distance;
+ ClosestHeldPoint = closest;
+ }
+ }
+
+ if (DropDistance != -1 && hand.CurrentInteractionStyle != InterationStyle.ByScript && shortestDistance > DropDistance)
+ {
+ DroppedBecauseOfDistance(hand);
+
+ if (IsAttached == false)
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ protected virtual void Update()
+ {
+ }
+
+ public virtual void BeginInteraction(NVRHand hand)
+ {
+ AttachedHands.Add(hand);
+
+ if (DisableKinematicOnAttach == true)
+ {
+ Rigidbody.isKinematic = false;
+ }
+ }
+
+ public virtual void InteractingUpdate(NVRHand hand)
+ {
+ if (hand.UseButtonUp == true)
+ {
+ UseButtonUp();
+
+ if (hand.OnEndUseInteraction != null)
+ {
+ hand.OnEndUseInteraction.Invoke(this);
+ }
+ }
+
+ if (hand.UseButtonDown == true)
+ {
+ UseButtonDown();
+
+ if (hand.OnBeginUseInteraction != null)
+ {
+ hand.OnBeginUseInteraction.Invoke(this);
+ }
+ }
+ }
+
+ public virtual void HoveringUpdate(NVRHand hand, float forTime)
+ {
+
+ }
+
+ public void ForceDetach(NVRHand hand = null)
+ {
+ if (hand != null)
+ {
+ hand.EndInteraction(this);
+ this.EndInteraction(hand); //hand should call this in most cases, but rarely hand / item gets disconnected on force detach
+ }
+ else
+ {
+ for (int handIndex = (AttachedHands.Count-1); handIndex >= 0; handIndex--)
+ {
+ NVRHand detaching = AttachedHands[handIndex];
+ detaching.EndInteraction(this);
+ this.EndInteraction(detaching);
+ }
+ }
+ }
+
+ public virtual void EndInteraction(NVRHand hand)
+ {
+ AttachedHands.Remove(hand);
+ if (AttachedHands.Count == 0) {
+ ClosestHeldPoint = Vector3.zero;
+
+ if (EnableKinematicOnDetach == true) {
+ Rigidbody.isKinematic = true;
+ }
+
+ if (EnableGravityOnDetach == true) {
+ Rigidbody.useGravity = true;
+ }
+ }
+ }
+
+ protected virtual void DroppedBecauseOfDistance(NVRHand hand)
+ {
+ hand.EndInteraction(this);
+ }
+
+ public virtual void UseButtonUp()
+ {
+
+ }
+
+ public virtual void UseButtonDown()
+ {
+
+ }
+
+
+ public virtual void AddExternalVelocity(Vector3 velocity)
+ {
+ Rigidbody.AddForce(velocity, ForceMode.VelocityChange);
+ }
+
+ public virtual void AddExternalAngularVelocity(Vector3 angularVelocity)
+ {
+ Rigidbody.AddTorque(angularVelocity, ForceMode.VelocityChange);
+ }
+
+ protected virtual void OnDestroy()
+ {
+ ForceDetach();
+ NVRInteractables.Deregister(this);
+ }
+ }
+}
diff --git a/Assets/NewtonVR/NVRInteractableItemClippable.cs b/Assets/NewtonVR/NVRInteractableItemClippable.cs
index 6b935a21..3d2f5331 100644
--- a/Assets/NewtonVR/NVRInteractableItemClippable.cs
+++ b/Assets/NewtonVR/NVRInteractableItemClippable.cs
@@ -1,41 +1,41 @@
-using UnityEngine;
-using System.Collections;
-
-namespace NewtonVR
-{
- ///
- /// This interactable item script clips through other colliders. If you don't want your item to respect other object's positions
- /// and have it go through walls/floors/etc then you can use this.
- ///
- public class NVRInteractableItemClippable : NVRInteractableItem
- {
- protected override void UpdateVelocities()
- {
- Vector3 targetItemPosition;
- Quaternion targetItemRotation;
-
- Vector3 targetHandPosition;
- Quaternion targetHandRotation;
-
- GetTargetValues(out targetHandPosition, out targetHandRotation, out targetItemPosition, out targetItemRotation);
-
- this.Rigidbody.MovePosition(targetHandPosition);
- this.Rigidbody.MoveRotation(targetHandRotation);
- }
-
- public override void BeginInteraction(NVRHand hand)
- {
- base.BeginInteraction(hand);
-
- this.Rigidbody.isKinematic = true;
- }
-
- public override void EndInteraction(NVRHand hand)
- {
- base.EndInteraction(hand);
-
- this.Rigidbody.isKinematic = false;
- }
-
- }
+using UnityEngine;
+using System.Collections;
+
+namespace NewtonVR
+{
+ ///
+ /// This interactable item script clips through other colliders. If you don't want your item to respect other object's positions
+ /// and have it go through walls/floors/etc then you can use this.
+ ///
+ public class NVRInteractableItemClippable : NVRInteractableItem
+ {
+ protected override void UpdateVelocities()
+ {
+ Vector3 targetItemPosition;
+ Quaternion targetItemRotation;
+
+ Vector3 targetHandPosition;
+ Quaternion targetHandRotation;
+
+ GetTargetValues(out targetHandPosition, out targetHandRotation, out targetItemPosition, out targetItemRotation);
+
+ this.Rigidbody.MovePosition(targetHandPosition);
+ this.Rigidbody.MoveRotation(targetHandRotation);
+ }
+
+ public override void BeginInteraction(NVRHand hand)
+ {
+ base.BeginInteraction(hand);
+
+ this.Rigidbody.isKinematic = true;
+ }
+
+ public override void EndInteraction(NVRHand hand)
+ {
+ base.EndInteraction(hand);
+
+ this.Rigidbody.isKinematic = false;
+ }
+
+ }
}
\ No newline at end of file
diff --git a/Assets/NewtonVR/NVRInteractableItemSnappable.cs b/Assets/NewtonVR/NVRInteractableItemSnappable.cs
new file mode 100644
index 00000000..54c852dc
--- /dev/null
+++ b/Assets/NewtonVR/NVRInteractableItemSnappable.cs
@@ -0,0 +1,153 @@
+using UnityEngine;
+
+namespace NewtonVR {
+
+ public class NVRInteractableItemSnappable : NVRInteractableItem {
+ public float snapToMeters = 0.05f;
+ public float snapToAngle = 15f;
+
+ private bool snap = false;
+ private bool set = false;
+ private Vector3 lastSnappedPosition;
+ private Vector3 lastSnappedRotation;
+
+ [SerializeField]
+ private positionalSnapping snappingType = positionalSnapping.objects;
+
+ private enum positionalSnapping {
+ grid,
+ objects
+ }
+
+ private NVRSnappable snappable;
+
+ protected override void Start () {
+ base.Start ();
+
+ if (!(GetComponent ())) {
+ snappable = gameObject.AddComponent ();
+ OnBeginInteraction.AddListener (snappable.StartSnapping);
+ OnEndInteraction.AddListener (snappable.StopSnapping);
+ }
+ }
+
+ private Vector3 SnapPosition (Vector3 pos) {
+ if (set) {
+ var weighted = snapToMeters / 5f;
+ pos.x = (pos.x >= lastSnappedPosition.x) ? pos.x -= weighted : pos.x += weighted;
+ pos.y = (pos.y >= lastSnappedPosition.y) ? pos.y -= weighted : pos.y += weighted;
+ pos.z = (pos.z >= lastSnappedPosition.z) ? pos.z -= weighted : pos.z += weighted;
+ }
+
+ pos.x = Mathf.Round (pos.x / snapToMeters) * snapToMeters;
+ pos.y = Mathf.Round (pos.y / snapToMeters) * snapToMeters;
+ pos.z = Mathf.Round (pos.z / snapToMeters) * snapToMeters;
+
+ lastSnappedPosition = pos;
+ set = true;
+ return pos;
+ }
+
+ private Quaternion SnapRotation (Quaternion rot) {
+ var rounded = rot.eulerAngles;
+
+ if (set) {
+ var weighted = snapToAngle / 10f;
+ rounded.x = (rounded.x >= lastSnappedRotation.x) ? rounded.x -= weighted : rounded.x += weighted;
+ rounded.y = (rounded.y >= lastSnappedRotation.y) ? rounded.y -= weighted : rounded.y += weighted;
+ rounded.z = (rounded.z >= lastSnappedRotation.z) ? rounded.z -= weighted : rounded.z += weighted;
+ }
+
+ rounded.x = Mathf.Round (rounded.x / snapToAngle) * snapToAngle;
+ rounded.y = Mathf.Round (rounded.y / snapToAngle) * snapToAngle;
+ rounded.z = Mathf.Round (rounded.z / snapToAngle) * snapToAngle;
+ rot.eulerAngles = rounded;
+
+ lastSnappedRotation = rounded;
+ //set = true;
+ return rot;
+ }
+
+ protected override void UpdateVelocities () {
+ foreach (var hand in AttachedHands) {
+ if (hand.UseButtonDown) {
+ snap = !snap;
+ break;
+ }
+ }
+
+ Vector3 targetItemPosition;
+ Quaternion targetItemRotation;
+
+ Vector3 targetHandPosition;
+ Quaternion targetHandRotation;
+
+ GetTargetValues (out targetHandPosition, out targetHandRotation, out targetItemPosition, out targetItemRotation);
+
+ float velocityMagic = VelocityMagic / (Time.deltaTime / NVRPlayer.NewtonVRExpectedDeltaTime);
+ float angularVelocityMagic = AngularVelocityMagic / (Time.deltaTime / NVRPlayer.NewtonVRExpectedDeltaTime);
+
+ // Snap position
+ if (snappingType == positionalSnapping.objects) {
+ NVRAlignment targetAlignment = snappable.SnapToNearest (targetHandPosition, .1f);
+ if (targetAlignment == null) {
+ return;
+ }
+
+ targetHandPosition = targetAlignment.position;
+
+ Vector3 positionDelta = (targetHandPosition - targetItemPosition);
+ Vector3 velocityTarget = (positionDelta * velocityMagic) * Time.deltaTime;
+ if (float.IsNaN (velocityTarget.x) == false) {
+ this.Rigidbody.velocity = Vector3.MoveTowards (this.Rigidbody.velocity, velocityTarget, MaxVelocityChange);
+ }
+ }
+
+ if (snappingType == positionalSnapping.grid && snap) {
+ targetHandPosition = SnapPosition (targetHandPosition);
+
+ Vector3 positionDelta = (targetHandPosition - targetItemPosition);
+ Vector3 velocityTarget = (positionDelta * velocityMagic) * Time.deltaTime;
+ if (float.IsNaN (velocityTarget.x) == false) {
+ this.Rigidbody.velocity = Vector3.MoveTowards (this.Rigidbody.velocity, velocityTarget, MaxVelocityChange);
+ }
+ }
+
+ // Snap to nearest degrees
+ if (snap) {
+ targetHandRotation = SnapRotation (targetHandRotation);
+ }
+ Quaternion rotationDelta = targetHandRotation * Quaternion.Inverse (targetItemRotation);
+
+ float angle;
+ Vector3 axis;
+ rotationDelta.ToAngleAxis (out angle, out axis);
+
+ if (angle > 180)
+ angle -= 360;
+
+ if (angle != 0) {
+ Vector3 angularTarget = angle * axis;
+ if (float.IsNaN (angularTarget.x) == false) {
+ angularTarget = (angularTarget * angularVelocityMagic) * Time.deltaTime;
+ this.Rigidbody.angularVelocity = Vector3.MoveTowards (this.Rigidbody.angularVelocity, angularTarget, MaxAngularVelocityChange);
+ }
+ }
+
+ if (VelocityHistory != null) {
+ CurrentVelocityHistoryStep++;
+ if (CurrentVelocityHistoryStep >= VelocityHistory.Length) {
+ CurrentVelocityHistoryStep = 0;
+ }
+
+ VelocityHistory[CurrentVelocityHistoryStep] = this.Rigidbody.velocity;
+ AngularVelocityHistory[CurrentVelocityHistoryStep] = this.Rigidbody.angularVelocity;
+ }
+ }
+
+ public override void BeginInteraction (NVRHand hand) {
+ snap = false;
+ base.BeginInteraction (hand);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/NewtonVR/NVRInteractableItemSnappable.cs.meta b/Assets/NewtonVR/NVRInteractableItemSnappable.cs.meta
new file mode 100644
index 00000000..304951ea
--- /dev/null
+++ b/Assets/NewtonVR/NVRInteractableItemSnappable.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: 246b26fc3b34a5b45b261916d4a69997
+timeCreated: 1508436376
+licenseType: Pro
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/NewtonVR/NVRInteractables.cs b/Assets/NewtonVR/NVRInteractables.cs
index 1a046e88..3ea1e1f7 100644
--- a/Assets/NewtonVR/NVRInteractables.cs
+++ b/Assets/NewtonVR/NVRInteractables.cs
@@ -15,10 +15,13 @@ public class NVRInteractables : MonoBehaviour
public static void Initialize()
{
- ColliderMapping = new Dictionary();
- NVRInteractableMapping = new Dictionary();
- NVRInteractableList = new List();
-
+ if (! Initialized)
+ {
+ ColliderMapping = new Dictionary();
+ NVRInteractableMapping = new Dictionary();
+ NVRInteractableList = new List();
+ }
+
Initialized = true;
}
@@ -26,7 +29,8 @@ public static void Register(NVRInteractable interactable, Collider[] colliders)
{
if (Initialized == false)
{
- Debug.LogError("[NewtonVR] Error: NVRInteractables.Register called before initialization.");
+ Debug.LogWarning("[NewtonVR] Warning: NVRInteractables.Register called before initialization.");
+ Initialize();
}
NVRInteractableMapping[interactable] = colliders;
@@ -46,7 +50,8 @@ public static void Deregister(NVRInteractable interactable)
{
if (Initialized == false)
{
- Debug.LogError("[NewtonVR] Error: NVRInteractables.Register called before initialization.");
+ Debug.LogWarning("[NewtonVR] Warning: NVRInteractables.Deregister called before initialization.");
+ Initialize();
}
NVRPlayer.DeregisterInteractable(interactable);
@@ -61,7 +66,8 @@ public static NVRInteractable GetInteractable(Collider collider)
{
if (Initialized == false)
{
- Debug.LogError("[NewtonVR] Error: NVRInteractables.Register called before initialization.");
+ Debug.LogWarning("[NewtonVR] Warning: NVRInteractables.GetInteractable called before initialization.");
+ Initialize();
}
NVRInteractable interactable;
@@ -74,4 +80,4 @@ public static List GetAllInteractables()
return NVRInteractableList;
}
}
-}
\ No newline at end of file
+}
diff --git a/Assets/NewtonVR/NVRPhysicalController.cs b/Assets/NewtonVR/NVRPhysicalController.cs
index dddf4cca..2b8402a2 100644
--- a/Assets/NewtonVR/NVRPhysicalController.cs
+++ b/Assets/NewtonVR/NVRPhysicalController.cs
@@ -23,7 +23,7 @@ public class NVRPhysicalController : MonoBehaviour
protected float AttachedRotationMagic = 20f;
protected float AttachedPositionMagic = 3000f;
- private Type[] KeepTypes = new Type[] {typeof(MeshFilter), typeof(Renderer), typeof(Transform), typeof(Rigidbody)};
+ private Type[] KeepTypes = new Type[] {typeof(MeshFilter), typeof(Renderer), typeof(Transform), typeof(Rigidbody), typeof(CanvasRenderer)};
public void Initialize(NVRHand trackingHand, bool initialState)
{
@@ -47,6 +47,11 @@ public void Initialize(NVRHand trackingHand, bool initialState)
}
}
+ foreach (Transform child in PhysicalController.transform)
+ {
+ Destroy(child.gameObject);
+ }
+
PhysicalController.transform.parent = Hand.transform.parent;
PhysicalController.transform.position = Hand.transform.position;
PhysicalController.transform.rotation = Hand.transform.rotation;
@@ -209,4 +214,4 @@ protected void SetupCustomModel()
Colliders = customCollidersTransform.GetComponentsInChildren();
}
}
-}
\ No newline at end of file
+}
diff --git a/Assets/NewtonVR/NVRPlayer.cs b/Assets/NewtonVR/NVRPlayer.cs
index ec60cc22..26b1e6b5 100644
--- a/Assets/NewtonVR/NVRPlayer.cs
+++ b/Assets/NewtonVR/NVRPlayer.cs
@@ -233,9 +233,9 @@ private NVRSDKIntegrations DetermineCurrentIntegration(bool logOutput = true)
NVRSDKIntegrations currentIntegration = NVRSDKIntegrations.None;
string resultLog = "[NewtonVR] Version : " + NewtonVRVersion + ". ";
- if (VRDevice.isPresent == true)
+ if (UnityEngine.XR.XRDevice.isPresent == true)
{
- resultLog += "Found VRDevice: " + VRDevice.model + ". ";
+ resultLog += "Found VRDevice: " + UnityEngine.XR.XRDevice.model + ". ";
#if !NVR_Oculus && !NVR_SteamVR
string warning = "Neither SteamVR or Oculus SDK is enabled in the NVRPlayer. Please check the \"Enable SteamVR\" or \"Enable Oculus SDK\" checkbox in the NVRPlayer script in the NVRPlayer GameObject.";
diff --git a/Assets/NewtonVR/NVRSnappingInteractableItem.cs b/Assets/NewtonVR/NVRSnappingInteractableItem.cs
new file mode 100644
index 00000000..540a8812
--- /dev/null
+++ b/Assets/NewtonVR/NVRSnappingInteractableItem.cs
@@ -0,0 +1,127 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace NewtonVR {
+
+ public class NVRSnappingInteractableItem : NVRInteractableItem {
+ public float snapToMeters = 0.05f;
+ public float snapToDegrees = 45f;
+
+ private bool snap = false;
+ private bool set = false;
+ private Vector3 lastSnappedPosition;
+ private Vector3 lastSnappedRotation;
+
+ private Vector3 SnapPosition (Vector3 pos) {
+ if (set) {
+ var weighted = snapToMeters / 5f;
+ pos.x = (pos.x >= lastSnappedPosition.x) ? pos.x -= weighted : pos.x += weighted;
+ pos.y = (pos.y >= lastSnappedPosition.y) ? pos.y -= weighted : pos.y += weighted;
+ pos.z = (pos.z >= lastSnappedPosition.z) ? pos.z -= weighted : pos.z += weighted;
+ }
+
+ pos.x = Mathf.Round (pos.x / snapToMeters) * snapToMeters;
+ pos.y = Mathf.Round (pos.y / snapToMeters) * snapToMeters;
+ pos.z = Mathf.Round (pos.z / snapToMeters) * snapToMeters;
+
+ lastSnappedPosition = pos;
+ set = true;
+ return pos;
+ }
+
+ private Quaternion SnapRotation (Quaternion rot) {
+ var rounded = rot.eulerAngles;
+
+ if (set) {
+ var weighted = snapToDegrees / 10f;
+ rounded.x = (rounded.x >= lastSnappedRotation.x) ? rounded.x -= weighted : rounded.x += weighted;
+ rounded.y = (rounded.y >= lastSnappedRotation.y) ? rounded.y -= weighted : rounded.y += weighted;
+ rounded.z = (rounded.z >= lastSnappedRotation.z) ? rounded.z -= weighted : rounded.z += weighted;
+ }
+
+ rounded.x = Mathf.Round (rounded.x / snapToDegrees) * snapToDegrees;
+ rounded.y = Mathf.Round (rounded.y / snapToDegrees) * snapToDegrees;
+ rounded.z = Mathf.Round (rounded.z / snapToDegrees) * snapToDegrees;
+ rot.eulerAngles = rounded;
+
+ lastSnappedRotation = rounded;
+ //set = true;
+ return rot;
+ }
+
+ protected override void UpdateVelocities () {
+ foreach (var hand in AttachedHands) {
+ if (hand.UseButtonDown) {
+ snap = !snap;
+ break;
+ }
+ }
+
+ if (!snap) {
+ base.UpdateVelocities ();
+ return;
+ }
+
+ Vector3 targetItemPosition;
+ Quaternion targetItemRotation;
+
+ Vector3 targetHandPosition;
+ Quaternion targetHandRotation;
+
+ GetTargetValues (out targetHandPosition, out targetHandRotation, out targetItemPosition, out targetItemRotation);
+
+ float velocityMagic = VelocityMagic / (Time.deltaTime / NVRPlayer.NewtonVRExpectedDeltaTime);
+ float angularVelocityMagic = AngularVelocityMagic / (Time.deltaTime / NVRPlayer.NewtonVRExpectedDeltaTime);
+
+ Vector3 positionDelta;
+ Quaternion rotationDelta;
+
+ float angle;
+ Vector3 axis;
+
+ // Snap to nearest meters
+ targetHandPosition = SnapPosition (targetHandPosition);
+
+ positionDelta = (targetHandPosition - targetItemPosition);
+
+ // Snap to nearest degrees
+ targetHandRotation = SnapRotation (targetHandRotation);
+
+ rotationDelta = targetHandRotation * Quaternion.Inverse (targetItemRotation);
+
+ Vector3 velocityTarget = (positionDelta * velocityMagic) * Time.deltaTime;
+ if (float.IsNaN (velocityTarget.x) == false) {
+ this.Rigidbody.velocity = Vector3.MoveTowards (this.Rigidbody.velocity, velocityTarget, MaxVelocityChange);
+ }
+
+ rotationDelta.ToAngleAxis (out angle, out axis);
+
+ if (angle > 180)
+ angle -= 360;
+
+ if (angle != 0) {
+ Vector3 angularTarget = angle * axis;
+ if (float.IsNaN (angularTarget.x) == false) {
+ angularTarget = (angularTarget * angularVelocityMagic) * Time.deltaTime;
+ this.Rigidbody.angularVelocity = Vector3.MoveTowards (this.Rigidbody.angularVelocity, angularTarget, MaxAngularVelocityChange);
+ }
+ }
+
+ if (VelocityHistory != null) {
+ CurrentVelocityHistoryStep++;
+ if (CurrentVelocityHistoryStep >= VelocityHistory.Length) {
+ CurrentVelocityHistoryStep = 0;
+ }
+
+ VelocityHistory[CurrentVelocityHistoryStep] = this.Rigidbody.velocity;
+ AngularVelocityHistory[CurrentVelocityHistoryStep] = this.Rigidbody.angularVelocity;
+ }
+ }
+
+ public override void BeginInteraction (NVRHand hand) {
+ snap = false;
+ base.BeginInteraction (hand);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/NewtonVR/NVRSnappingInteractableItem.cs.meta b/Assets/NewtonVR/NVRSnappingInteractableItem.cs.meta
new file mode 100644
index 00000000..397f9ee7
--- /dev/null
+++ b/Assets/NewtonVR/NVRSnappingInteractableItem.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: ac411f032831fc84aa17b9aa14dff341
+timeCreated: 1505161948
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/NewtonVR/NVRVirtualHand.cs b/Assets/NewtonVR/NVRVirtualHand.cs
new file mode 100644
index 00000000..e6f76f2d
--- /dev/null
+++ b/Assets/NewtonVR/NVRVirtualHand.cs
@@ -0,0 +1,153 @@
+using UnityEngine;
+using System.Collections.Generic;
+
+namespace NewtonVR
+{
+ public class NVRVirtualHand : NVRHand
+ {
+ public enum Handedness
+ {
+ Left,
+ Right
+ }
+
+ public Handedness Hand;
+
+ public float radius = 0.5f;
+
+ void Start ()
+ {
+ PreInitialize(null);
+ }
+
+ public override void PreInitialize(NVRPlayer player)
+ {
+ IsLeft = Hand == Handedness.Left;
+ IsRight = Hand == Handedness.Right;
+
+ Player = NVRPlayer.Instance;
+
+ CurrentInteractionStyle = InterationStyle.Hold;
+
+ CurrentlyHoveringOver = new Dictionary>();
+
+ LastPositions = new Vector3[EstimationSamples];
+ LastRotations = new Quaternion[EstimationSamples];
+ LastDeltas = new float[EstimationSamples];
+ EstimationSampleIndex = 0;
+
+ VisibilityLocked = false;
+
+ Inputs = new Dictionary(new NVRButtonsComparer());
+ for (int buttonIndex = 0; buttonIndex < NVRButtonsHelper.Array.Length; buttonIndex++)
+ {
+ if (Inputs.ContainsKey(NVRButtonsHelper.Array[buttonIndex]) == false)
+ {
+ Inputs.Add(NVRButtonsHelper.Array[buttonIndex], new NVRButtonInputs());
+ }
+ }
+
+ var virtualInputDevice = this.gameObject.AddComponent ();
+ virtualInputDevice.radius = radius;
+ InputDevice = virtualInputDevice;
+ InputDevice.Initialize (this);
+
+ InitializeRenderModel();
+ }
+
+ protected override void Update()
+ {
+ if (CurrentHandState == HandState.Uninitialized)
+ {
+ if (InputDevice == null || InputDevice.ReadyToInitialize() == false)
+ {
+ return;
+ }
+ else
+ {
+ Initialize();
+ return;
+ }
+ }
+
+ UpdateHovering();
+
+ UpdateVisibilityAndColliders();
+ }
+
+ public void Hold()
+ {
+ PickupClosest();
+
+ if (IsInteracting)
+ {
+ CurrentHandState = HandState.GripToggleOnInteracting;
+ }
+ }
+
+ public void Hold(string withID)
+ {
+ PickupByName(withID);
+
+ if (IsInteracting)
+ {
+ CurrentHandState = HandState.GripToggleOnInteracting;
+ }
+ }
+
+ public void Release()
+ {
+ if (CurrentlyInteracting != null)
+ {
+ EndInteraction (null);
+ }
+ }
+
+ public void Use()
+ {
+ if (CurrentlyInteracting != null)
+ {
+ CurrentlyInteracting.UseButtonDown ();
+ }
+ }
+
+ public void EndUse()
+ {
+ if (CurrentlyInteracting != null)
+ {
+ CurrentlyInteracting.UseButtonUp();
+ }
+ }
+
+ public override void Initialize()
+ {
+ Rigidbody = this.GetComponent();
+ if (Rigidbody == null)
+ Rigidbody = this.gameObject.AddComponent();
+ Rigidbody.isKinematic = true;
+ Rigidbody.maxAngularVelocity = float.MaxValue;
+ Rigidbody.useGravity = false;
+
+ Collider[] colliders = null;
+
+ colliders = InputDevice.SetupDefaultColliders();
+
+ if (PhysicalController != null)
+ {
+ PhysicalController.Kill();
+ }
+
+ PhysicalController = this.gameObject.AddComponent();
+ PhysicalController.Initialize(this, false);
+
+ if (colliders != null)
+ {
+ GhostColliders = colliders;
+ }
+
+ CurrentVisibility = VisibilityLevel.Visible;
+
+ CurrentHandState = HandState.Idle;
+ }
+ }
+}
diff --git a/Assets/NewtonVR/NVRVirtualHand.cs.meta b/Assets/NewtonVR/NVRVirtualHand.cs.meta
new file mode 100644
index 00000000..da2a8782
--- /dev/null
+++ b/Assets/NewtonVR/NVRVirtualHand.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 1a83e007c2b15534398d66a2ae8c006d
+timeCreated: 1490298892
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/NewtonVR/NVRVirtualInputDevice.cs b/Assets/NewtonVR/NVRVirtualInputDevice.cs
new file mode 100644
index 00000000..4389e1d5
--- /dev/null
+++ b/Assets/NewtonVR/NVRVirtualInputDevice.cs
@@ -0,0 +1,154 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using UnityEngine;
+
+namespace NewtonVR
+{
+ public class NVRVirtualInputDevice : NVRInputDevice
+ {
+ private GameObject RenderModel;
+
+ public float radius = 0.5f;
+
+ public override void Initialize(NVRHand hand)
+ {
+ base.Initialize(hand);
+ }
+
+ public override float GetAxis1D(NVRButtons button)
+ {
+ // Do nothing
+ return 0f;
+ }
+
+ public override Vector2 GetAxis2D(NVRButtons button)
+ {
+ // Do nothing
+ return Vector2.zero;
+ }
+
+ public override bool GetPressDown(NVRButtons button)
+ {
+ // Do nothing
+ return false;
+ }
+
+ public override bool GetPressUp(NVRButtons button)
+ {
+ // Do nothing
+ return false;
+ }
+
+ public override bool GetPress(NVRButtons button)
+ {
+ // Do nothing
+ return false;
+ }
+
+ public override bool GetTouchDown(NVRButtons button)
+ {
+ // Do nothing
+ return false;
+ }
+
+ public override bool GetTouchUp(NVRButtons button)
+ {
+ // Do nothing
+ return false;
+ }
+
+ public override bool GetTouch(NVRButtons button)
+ {
+ // Do nothing
+ return false;
+ }
+
+ public override bool GetNearTouchDown(NVRButtons button)
+ {
+ // Do nothing
+ return false;
+ }
+
+ public override bool GetNearTouchUp(NVRButtons button)
+ {
+ // Do nothing
+ return false;
+ }
+
+ public override bool GetNearTouch(NVRButtons button)
+ {
+ // Do nothing
+ return false;
+ }
+
+ public override void TriggerHapticPulse(ushort durationMicroSec = 500, NVRButtons button = NVRButtons.Touchpad)
+ {
+ // Do nothing
+ }
+
+ public override bool IsCurrentlyTracked
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+
+ public override GameObject SetupDefaultRenderModel()
+ {
+ RenderModel = Hand.gameObject;
+
+ return RenderModel;
+ }
+
+ public override bool ReadyToInitialize()
+ {
+ return true;
+ }
+
+ public override string GetDeviceName()
+ {
+ if (Hand.HasCustomModel == true)
+ {
+ return "Custom";
+ }
+ else if (Hand.IsLeft)
+ {
+ return "VirtualLeft";
+ } else
+ {
+ return "VirtualRight";
+ }
+ }
+
+ public override Collider[] SetupDefaultPhysicalColliders(Transform ModelParent)
+ {
+ Collider[] Colliders = null;
+
+ SphereCollider Collider = GetComponent();
+
+ Colliders = new Collider[] { Collider };
+
+ return Colliders;
+ }
+
+ public override Collider[] SetupDefaultColliders()
+ {
+ Collider[] Colliders = null;
+
+ SphereCollider Collider = RenderModel.AddComponent();
+ Collider.isTrigger = true;
+ Collider.radius = radius;
+
+ Colliders = new Collider[] { Collider };
+
+ return Colliders;
+ }
+
+ }
+}
diff --git a/Assets/NewtonVR/NVRVirtualInputDevice.cs.meta b/Assets/NewtonVR/NVRVirtualInputDevice.cs.meta
new file mode 100644
index 00000000..d031db69
--- /dev/null
+++ b/Assets/NewtonVR/NVRVirtualInputDevice.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 03f297ad42d9f784492134e2059ffb2b
+timeCreated: 1490298892
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/NewtonVR/Oculus/NVROculusInputDevice.cs b/Assets/NewtonVR/Oculus/NVROculusInputDevice.cs
index 9595fc47..80b19b48 100644
--- a/Assets/NewtonVR/Oculus/NVROculusInputDevice.cs
+++ b/Assets/NewtonVR/Oculus/NVROculusInputDevice.cs
@@ -52,7 +52,8 @@ protected virtual void SetupButtonMapping()
ButtonMapping.Add(NVRButtons.Trigger, OVRInput.Button.PrimaryIndexTrigger);
ButtonMapping.Add(NVRButtons.Grip, OVRInput.Button.PrimaryHandTrigger);
ButtonMapping.Add(NVRButtons.System, OVRInput.Button.Back);
-
+ ButtonMapping.Add(NVRButtons.ApplicationMenu, OVRInput.Button.Start);
+
TouchMapping.Add(NVRButtons.A, OVRInput.Touch.One);
TouchMapping.Add(NVRButtons.B, OVRInput.Touch.Two);
TouchMapping.Add(NVRButtons.X, OVRInput.Touch.One);
@@ -272,7 +273,7 @@ public override Collider[] SetupDefaultColliders()
SphereCollider OculusCollider = RenderModel.AddComponent();
OculusCollider.isTrigger = true;
- OculusCollider.radius = 0.15f;
+ OculusCollider.radius = 0.05f;
Colliders = new Collider[] { OculusCollider };
diff --git a/Assets/NewtonVR/Snappable.meta b/Assets/NewtonVR/Snappable.meta
new file mode 100644
index 00000000..e4eaba77
--- /dev/null
+++ b/Assets/NewtonVR/Snappable.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: af5159f5c50305a4690120e6bf031030
+folderAsset: yes
+timeCreated: 1508436376
+licenseType: Pro
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/NewtonVR/Snappable/NVRAlignment.cs b/Assets/NewtonVR/Snappable/NVRAlignment.cs
new file mode 100644
index 00000000..350f5925
--- /dev/null
+++ b/Assets/NewtonVR/Snappable/NVRAlignment.cs
@@ -0,0 +1,37 @@
+using UnityEngine;
+
+namespace NewtonVR {
+
+ ///
+ /// Structure used for passing simple transformation data
+ ///
+ public class NVRAlignment {
+ public Vector3 position;
+ public Quaternion rotation;
+ public Vector3 scale;
+
+ public NVRAlignment (Transform transform) {
+ position = transform.position;
+ rotation = transform.rotation;
+ scale = transform.localScale;
+ }
+
+ public NVRAlignment (Vector3 position, Quaternion rotation, Vector3 scale) {
+ this.position = position;
+ this.rotation = rotation;
+ this.scale = scale;
+ }
+
+ public float Distance (Transform transform) {
+ return (Distance (new NVRAlignment (transform.position, transform.rotation, transform.localScale)));
+ }
+
+ public float Distance (NVRAlignment alignment) {
+ float distance = 0;
+ distance += Vector3.Distance (position, alignment.position);
+ distance += (Quaternion.Angle (rotation, alignment.rotation) / 90) * scale.x;
+
+ return distance;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/NewtonVR/Snappable/NVRAlignment.cs.meta b/Assets/NewtonVR/Snappable/NVRAlignment.cs.meta
new file mode 100644
index 00000000..607fb45e
--- /dev/null
+++ b/Assets/NewtonVR/Snappable/NVRAlignment.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 5b3ca1b57b53855479a72a83d3144290
+timeCreated: 1507735833
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/NewtonVR/Snappable/NVRSnappable.cs b/Assets/NewtonVR/Snappable/NVRSnappable.cs
new file mode 100644
index 00000000..41a6c543
--- /dev/null
+++ b/Assets/NewtonVR/Snappable/NVRSnappable.cs
@@ -0,0 +1,104 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace NewtonVR {
+
+ public class NVRSnappable : MonoBehaviour {
+
+ ///
+ /// Shared list of add snappable objects
+ ///
+ public static List snappables;
+
+ public Collider[] colliders;
+ public bool snapping = false;
+
+ ///
+ /// Clears snappables
+ ///
+ public static void ClearSnappables () {
+ snappables.Clear ();
+ }
+
+ public void StartSnapping () {
+ snapping = true;
+ }
+
+ public void StopSnapping () {
+ snapping = false;
+ }
+
+ public NVRAlignment SnapToNearest (Vector3 position, float maxSnapDistance) {
+ NVRAlignment startingAlignment = new NVRAlignment (position, transform.rotation, transform.localScale);
+ NVRAlignment newAlignment = startingAlignment;
+
+ float bestAlignmentDistance = float.MaxValue;
+
+ Bounds ourBounds = GetBounds ();
+
+ foreach (NVRSnappable snappable in snappables) {
+ if (snappable != this) {
+ Bounds snapToBounds = snappable.GetBounds ();
+ NVRAlignment alignment = SnapToBounds (position, snapToBounds);
+
+ Vector3 bottomOfSnappable = new Vector3 (position.x, ourBounds.min.y, position.z);
+
+ float alignmentDistance = Mathf.Max (Vector3.Distance (bottomOfSnappable, snapToBounds.ClosestPoint (bottomOfSnappable)), startingAlignment.Distance (alignment));
+
+ if (alignmentDistance < bestAlignmentDistance && alignmentDistance <= maxSnapDistance) {
+ newAlignment = alignment;
+ bestAlignmentDistance = alignmentDistance;
+ }
+ }
+ }
+
+ return newAlignment;
+ }
+
+ public NVRAlignment SnapToBounds (Vector3 position, Bounds snappingBounds) {
+ NVRAlignment alignment = new NVRAlignment (position, transform.rotation, transform.localScale);
+ Bounds mybounds = GetBounds ();
+
+ Vector3 boundsOffset = transform.position - mybounds.center;
+ alignment.position.y = snappingBounds.center.y + snappingBounds.extents.y + mybounds.extents.y + boundsOffset.y;
+ return alignment;
+ }
+
+ public Bounds GetBounds () { //this could be cached for objects that aren't moving
+ Bounds bounds = colliders[0].bounds;
+ for (int i = 1; i < colliders.Length; i++) {
+ bounds.Encapsulate (colliders[1].bounds);
+ }
+ return bounds;
+ }
+
+ private void Start () {
+ colliders = GetComponentsInChildren ();
+ }
+
+ private void OnEnable () {
+ TrackSelf ();
+ }
+
+ private void OnDestroy () {
+ ClearSelf ();
+ }
+
+ private void OnDisable () {
+ ClearSelf ();
+ }
+
+ private void TrackSelf () {
+ if (snappables == null) {
+ snappables = new List ();
+ }
+
+ snappables.Add (this);
+ }
+
+ private void ClearSelf () {
+ snappables.Remove (this);
+ StopSnapping ();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/NewtonVR/Snappable/NVRSnappable.cs.meta b/Assets/NewtonVR/Snappable/NVRSnappable.cs.meta
new file mode 100644
index 00000000..f0e63279
--- /dev/null
+++ b/Assets/NewtonVR/Snappable/NVRSnappable.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 90044591e14c9cb428bf74dd2e3ff52b
+timeCreated: 1507734616
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset
index 4ab5a7c6..e8b26732 100644
--- a/ProjectSettings/ProjectSettings.asset
+++ b/ProjectSettings/ProjectSettings.asset
@@ -3,9 +3,10 @@
--- !u!129 &1
PlayerSettings:
m_ObjectHideFlags: 0
- serializedVersion: 8
+ serializedVersion: 13
productGUID: e9ed52372c08aa34999d9d2e74c31cbf
AndroidProfiler: 0
+ AndroidFilterTouchesWhenObscured: 0
defaultScreenOrientation: 4
targetDevice: 2
useOnDemandResources: 0
@@ -14,21 +15,43 @@ PlayerSettings:
productName: NewtonVR
defaultCursor: {fileID: 0}
cursorHotspot: {x: 0, y: 0}
- m_SplashScreenStyle: 0
+ m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}
m_ShowUnitySplashScreen: 0
+ m_ShowUnitySplashLogo: 1
+ m_SplashScreenOverlayOpacity: 1
+ m_SplashScreenAnimation: 1
+ m_SplashScreenLogoStyle: 1
+ m_SplashScreenDrawMode: 0
+ m_SplashScreenBackgroundAnimationZoom: 1
+ m_SplashScreenLogoAnimationZoom: 1
+ m_SplashScreenBackgroundLandscapeAspect: 1
+ m_SplashScreenBackgroundPortraitAspect: 1
+ m_SplashScreenBackgroundLandscapeUvs:
+ serializedVersion: 2
+ x: 0
+ y: 0
+ width: 1
+ height: 1
+ m_SplashScreenBackgroundPortraitUvs:
+ serializedVersion: 2
+ x: 0
+ y: 0
+ width: 1
+ height: 1
+ m_SplashScreenLogos: []
m_VirtualRealitySplashScreen: {fileID: 0}
+ m_HolographicTrackingLossScreen: {fileID: 0}
defaultScreenWidth: 1024
defaultScreenHeight: 768
defaultScreenWidthWeb: 960
defaultScreenHeightWeb: 600
- m_RenderingPath: 1
- m_MobileRenderingPath: 1
+ m_StereoRenderingPath: 1
m_ActiveColorSpace: 1
m_MTRendering: 1
- m_MobileMTRendering: 0
m_StackTraceTypes: 010000000100000001000000010000000100000001000000
iosShowActivityIndicatorOnLoading: -1
androidShowActivityIndicatorOnLoading: -1
+ tizenShowActivityIndicatorOnLoading: -1
iosAppInBackgroundBehavior: 0
displayResolutionDialog: 2
iosAllowHTTPDownload: 1
@@ -39,18 +62,22 @@ PlayerSettings:
useOSAutorotation: 1
use32BitDisplayBuffer: 1
disableDepthAndStencilBuffers: 0
+ androidBlitType: 0
defaultIsFullScreen: 0
defaultIsNativeResolution: 1
+ macRetinaSupport: 1
runInBackground: 1
captureSingleScreen: 0
- Override IPod Music: 0
+ muteOtherAudioSources: 0
Prepare IOS For Recording: 0
+ Force IOS Speakers When Recording: 0
submitAnalytics: 1
usePlayerLog: 1
bakeCollisionMeshes: 0
forceSingleInstance: 0
resizableWindow: 1
useMacAppStoreValidation: 0
+ macAppStoreCategory: public.app-category.games
gpuSkinning: 1
graphicsJobs: 1
xboxPIXTextureCapture: 0
@@ -60,6 +87,7 @@ PlayerSettings:
xboxEnableFitness: 0
visibleInBackground: 1
allowFullscreenSwitch: 1
+ graphicsJobMode: 0
macFullscreenMode: 2
d3d9FullscreenMode: 1
d3d11FullscreenMode: 1
@@ -67,15 +95,16 @@ PlayerSettings:
xboxEnableHeadOrientation: 0
xboxEnableGuest: 0
xboxEnablePIXSampling: 0
+ metalFramebufferOnly: 0
n3dsDisableStereoscopicView: 0
n3dsEnableSharedListOpt: 1
n3dsEnableVSync: 0
- uiUse16BitDepthBuffer: 0
ignoreAlphaClear: 0
xboxOneResolution: 0
xboxOneMonoLoggingLevel: 0
xboxOneLoggingLevel: 1
- ps3SplashScreen: {fileID: 0}
+ xboxOneDisableEsram: 0
+ xboxOnePresentImmediateThreshold: 0
videoMemoryForVertexBuffers: 0
psp2PowerMode: 0
psp2AcquireBGM: 1
@@ -94,36 +123,60 @@ PlayerSettings:
16:10: 1
16:9: 1
Others: 1
- bundleIdentifier: com.oculus.UnitySample
bundleVersion: 1.0
preloadedAssets: []
- metroEnableIndependentInputSource: 0
+ metroInputSource: 0
+ m_HolographicPauseOnTrackingLoss: 1
xboxOneDisableKinectGpuReservation: 0
- singlePassStereoRendering: 1
+ xboxOneEnable7thCore: 0
+ vrSettings:
+ cardboard:
+ depthFormat: 0
+ enableTransitionView: 0
+ daydream:
+ depthFormat: 0
+ useSustainedPerformanceMode: 0
+ enableVideoLayer: 0
+ useProtectedVideoMemory: 0
+ hololens:
+ depthFormat: 1
protectGraphicsMemory: 0
+ useHDRDisplay: 0
+ m_ColorGamuts: 00000000
+ targetPixelDensity: 0
+ resolutionScalingMode: 0
+ androidSupportedAspectRatio: 1
+ androidMaxAspectRatio: 2.1
+ applicationIdentifier:
+ Android: com.oculus.UnitySample
+ Standalone: unity.Tomorrow Today Labs.NewtonVR
+ Tizen: com.oculus.UnitySample
+ iOS: com.oculus.UnitySample
+ tvOS: com.oculus.UnitySample
+ buildNumber:
+ iOS: 0
AndroidBundleVersionCode: 1
- AndroidMinSdkVersion: 9
+ AndroidMinSdkVersion: 16
+ AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 1
aotOptions:
- apiCompatibilityLevel: 2
stripEngineCode: 1
iPhoneStrippingLevel: 0
iPhoneScriptCallOptimization: 0
- iPhoneBuildNumber: 0
ForceInternetPermission: 0
ForceSDCardPermission: 0
CreateWallpaper: 0
APKExpansionFiles: 0
- preloadShaders: 0
+ keepLoadedShadersAlive: 0
StripUnusedMeshComponents: 0
VertexChannelCompressionMask:
serializedVersion: 2
m_Bits: 238
iPhoneSdkVersion: 988
- iPhoneTargetOSVersion: 22
+ iOSTargetOSVersionString: 7.0
tvOSSdkVersion: 0
- tvOSTargetOSVersion: 900
tvOSRequireExtendedGameController: 0
+ tvOSTargetOSVersionString: 9.0
uIPrerenderedIcon: 0
uIRequiresPersistentWiFi: 0
uIRequiresFullScreen: 1
@@ -144,6 +197,7 @@ PlayerSettings:
tvOSSmallIconLayers: []
tvOSLargeIconLayers: []
tvOSTopShelfImageLayers: []
+ tvOSTopShelfImageWideLayers: []
iOSLaunchScreenType: 0
iOSLaunchScreenPortrait: {fileID: 0}
iOSLaunchScreenLandscape: {fileID: 0}
@@ -163,7 +217,15 @@ PlayerSettings:
iOSLaunchScreeniPadCustomXibPath:
iOSDeviceRequirements: []
iOSURLSchemes: []
+ iOSBackgroundModes: 0
+ iOSMetalForceHardShadows: 0
+ metalEditorSupport: 1
+ metalAPIValidation: 1
+ iOSRenderExtraFrameOnPause: 1
appleDeveloperTeamID:
+ iOSManualSigningProvisioningProfileID:
+ tvOSManualSigningProvisioningProfileID:
+ appleEnableAutomaticSigning: 0
AndroidTargetDevice: 0
AndroidSplashScreenScale: 0
androidSplashScreen: {fileID: 0}
@@ -171,7 +233,9 @@ PlayerSettings:
AndroidKeyaliasName:
AndroidTVCompatibility: 1
AndroidIsGame: 1
+ AndroidEnableTango: 0
androidEnableBanner: 1
+ androidUseLowAccuracyLocation: 0
m_AndroidBanners:
- width: 320
height: 180
@@ -185,10 +249,72 @@ PlayerSettings:
m_Icon: {fileID: 0}
m_Width: 128
m_Height: 128
+ m_Kind: 0
m_BuildTargetBatching: []
m_BuildTargetGraphicsAPIs: []
- webPlayerTemplate: APPLICATION:Default
+ m_BuildTargetVRSettings:
+ - m_BuildTarget: Android
+ m_Enabled: 0
+ m_Devices:
+ - Oculus
+ - m_BuildTarget: Metro
+ m_Enabled: 0
+ m_Devices: []
+ - m_BuildTarget: N3DS
+ m_Enabled: 0
+ m_Devices: []
+ - m_BuildTarget: PS3
+ m_Enabled: 0
+ m_Devices: []
+ - m_BuildTarget: PS4
+ m_Enabled: 0
+ m_Devices:
+ - PlayStationVR
+ - m_BuildTarget: PSM
+ m_Enabled: 0
+ m_Devices: []
+ - m_BuildTarget: PSP2
+ m_Enabled: 0
+ m_Devices: []
+ - m_BuildTarget: SamsungTV
+ m_Enabled: 0
+ m_Devices: []
+ - m_BuildTarget: Standalone
+ m_Enabled: 1
+ m_Devices:
+ - Oculus
+ - OpenVR
+ - m_BuildTarget: Tizen
+ m_Enabled: 0
+ m_Devices: []
+ - m_BuildTarget: WebGL
+ m_Enabled: 0
+ m_Devices: []
+ - m_BuildTarget: WebPlayer
+ m_Enabled: 0
+ m_Devices: []
+ - m_BuildTarget: WiiU
+ m_Enabled: 0
+ m_Devices: []
+ - m_BuildTarget: Xbox360
+ m_Enabled: 0
+ m_Devices: []
+ - m_BuildTarget: XboxOne
+ m_Enabled: 0
+ m_Devices: []
+ - m_BuildTarget: iOS
+ m_Enabled: 0
+ m_Devices: []
+ - m_BuildTarget: tvOS
+ m_Enabled: 0
+ m_Devices: []
+ m_BuildTargetEnableVuforiaSettings: []
+ openGLRequireES31: 0
+ openGLRequireES31AEP: 0
m_TemplateCustomTags: {}
+ mobileMTRendering:
+ iPhone: 1
+ tvOS: 1
wiiUTitleID: 0005000011000000
wiiUGroupID: 00010000
wiiUCommonSaveSize: 4096
@@ -207,6 +333,7 @@ PlayerSettings:
wiiUGamePadStartupScreen: {fileID: 0}
wiiUDrcBufferDisabled: 0
wiiUProfilerLibPath:
+ playModeTestRunnerEnabled: 0
actionOnDotNetUnhandledException: 1
enableInternalProfiler: 0
logObjCUncaughtExceptions: 1
@@ -214,34 +341,116 @@ PlayerSettings:
cameraUsageDescription:
locationUsageDescription:
microphoneUsageDescription:
- XboxTitleId:
- XboxImageXexPath:
- XboxSpaPath:
- XboxGenerateSpa: 0
- XboxDeployKinectResources: 0
- XboxSplashScreen: {fileID: 0}
- xboxEnableSpeech: 0
- xboxAdditionalTitleMemorySize: 0
- xboxDeployKinectHeadOrientation: 0
- xboxDeployKinectHeadPosition: 0
- ps3TitleConfigPath:
- ps3DLCConfigPath:
- ps3ThumbnailPath:
- ps3BackgroundPath:
- ps3SoundPath:
- ps3NPAgeRating: 12
- ps3TrophyCommId:
- ps3NpCommunicationPassphrase:
- ps3TrophyPackagePath:
- ps3BootCheckMaxSaveGameSizeKB: 128
- ps3TrophyCommSig:
- ps3SaveGameSlots: 1
- ps3TrialMode: 0
- ps3VideoMemoryForAudio: 0
- ps3EnableVerboseMemoryStats: 0
- ps3UseSPUForUmbra: 0
- ps3EnableMoveSupport: 1
- ps3DisableDolbyEncoding: 0
+ switchNetLibKey:
+ switchSocketMemoryPoolSize: 6144
+ switchSocketAllocatorPoolSize: 128
+ switchSocketConcurrencyLimit: 14
+ switchScreenResolutionBehavior: 2
+ switchUseCPUProfiler: 0
+ switchApplicationID: 0x01004b9000490000
+ switchNSODependencies:
+ switchTitleNames_0:
+ switchTitleNames_1:
+ switchTitleNames_2:
+ switchTitleNames_3:
+ switchTitleNames_4:
+ switchTitleNames_5:
+ switchTitleNames_6:
+ switchTitleNames_7:
+ switchTitleNames_8:
+ switchTitleNames_9:
+ switchTitleNames_10:
+ switchTitleNames_11:
+ switchPublisherNames_0:
+ switchPublisherNames_1:
+ switchPublisherNames_2:
+ switchPublisherNames_3:
+ switchPublisherNames_4:
+ switchPublisherNames_5:
+ switchPublisherNames_6:
+ switchPublisherNames_7:
+ switchPublisherNames_8:
+ switchPublisherNames_9:
+ switchPublisherNames_10:
+ switchPublisherNames_11:
+ switchIcons_0: {fileID: 0}
+ switchIcons_1: {fileID: 0}
+ switchIcons_2: {fileID: 0}
+ switchIcons_3: {fileID: 0}
+ switchIcons_4: {fileID: 0}
+ switchIcons_5: {fileID: 0}
+ switchIcons_6: {fileID: 0}
+ switchIcons_7: {fileID: 0}
+ switchIcons_8: {fileID: 0}
+ switchIcons_9: {fileID: 0}
+ switchIcons_10: {fileID: 0}
+ switchIcons_11: {fileID: 0}
+ switchSmallIcons_0: {fileID: 0}
+ switchSmallIcons_1: {fileID: 0}
+ switchSmallIcons_2: {fileID: 0}
+ switchSmallIcons_3: {fileID: 0}
+ switchSmallIcons_4: {fileID: 0}
+ switchSmallIcons_5: {fileID: 0}
+ switchSmallIcons_6: {fileID: 0}
+ switchSmallIcons_7: {fileID: 0}
+ switchSmallIcons_8: {fileID: 0}
+ switchSmallIcons_9: {fileID: 0}
+ switchSmallIcons_10: {fileID: 0}
+ switchSmallIcons_11: {fileID: 0}
+ switchManualHTML:
+ switchAccessibleURLs:
+ switchLegalInformation:
+ switchMainThreadStackSize: 1048576
+ switchPresenceGroupId:
+ switchLogoHandling: 0
+ switchReleaseVersion: 0
+ switchDisplayVersion: 1.0.0
+ switchStartupUserAccount: 0
+ switchTouchScreenUsage: 0
+ switchSupportedLanguagesMask: 0
+ switchLogoType: 0
+ switchApplicationErrorCodeCategory:
+ switchUserAccountSaveDataSize: 0
+ switchUserAccountSaveDataJournalSize: 0
+ switchApplicationAttribute: 0
+ switchCardSpecSize: -1
+ switchCardSpecClock: -1
+ switchRatingsMask: 0
+ switchRatingsInt_0: 0
+ switchRatingsInt_1: 0
+ switchRatingsInt_2: 0
+ switchRatingsInt_3: 0
+ switchRatingsInt_4: 0
+ switchRatingsInt_5: 0
+ switchRatingsInt_6: 0
+ switchRatingsInt_7: 0
+ switchRatingsInt_8: 0
+ switchRatingsInt_9: 0
+ switchRatingsInt_10: 0
+ switchRatingsInt_11: 0
+ switchLocalCommunicationIds_0:
+ switchLocalCommunicationIds_1:
+ switchLocalCommunicationIds_2:
+ switchLocalCommunicationIds_3:
+ switchLocalCommunicationIds_4:
+ switchLocalCommunicationIds_5:
+ switchLocalCommunicationIds_6:
+ switchLocalCommunicationIds_7:
+ switchParentalControl: 0
+ switchAllowsScreenshot: 1
+ switchDataLossConfirmation: 0
+ switchSupportedNpadStyles: 3
+ switchSocketConfigEnabled: 0
+ switchTcpInitialSendBufferSize: 32
+ switchTcpInitialReceiveBufferSize: 64
+ switchTcpAutoSendBufferSizeMax: 256
+ switchTcpAutoReceiveBufferSizeMax: 256
+ switchUdpSendBufferSize: 9
+ switchUdpReceiveBufferSize: 42
+ switchSocketBufferEfficiency: 4
+ switchSocketInitializeEnabled: 1
+ switchNetworkInterfaceManagerInitializeEnabled: 1
+ switchPlayerConnectionEnabled: 1
ps4NPAgeRating: 12
ps4NPTitleSecret:
ps4NPTrophyPackPath:
@@ -254,6 +463,7 @@ PlayerSettings:
ps4ParamSfxPath:
ps4VideoOutPixelFormat: 0
ps4VideoOutInitialWidth: 1920
+ ps4VideoOutBaseModeInitialWidth: 1920
ps4VideoOutReprojectionRate: 120
ps4PronunciationXMLPath:
ps4PronunciationSIGPath:
@@ -276,15 +486,15 @@ PlayerSettings:
ps4ApplicationParam4: 0
ps4DownloadDataSize: 0
ps4GarlicHeapSize: 2048
+ ps4ProGarlicHeapSize: 2560
ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ
- ps4UseDebugIl2cppLibs: 0
ps4pnSessions: 1
ps4pnPresence: 1
ps4pnFriends: 1
ps4pnGameCustomData: 1
playerPrefsSupport: 0
- ps4UseResolutionFallback: 0
restrictedAudioUsageRights: 0
+ ps4UseResolutionFallback: 0
ps4ReprojectionSupport: 0
ps4UseAudio3dBackend: 0
ps4SocialScreenEnabled: 0
@@ -301,6 +511,9 @@ PlayerSettings:
ps4attribShareSupport: 0
ps4attribExclusiveVR: 0
ps4disableAutoHideSplash: 0
+ ps4videoRecordingFeaturesUsed: 0
+ ps4contentSearchFeaturesUsed: 0
+ ps4attribEyeToEyeDistanceSettingVR: 0
ps4IncludedModules: []
monoEnv:
psp2Splashimage: {fileID: 0}
@@ -349,11 +562,42 @@ PlayerSettings:
psp2UseLibLocation: 0
psp2InfoBarOnStartup: 0
psp2InfoBarColor: 0
- psp2UseDebugIl2cppLibs: 0
+ psp2ScriptOptimizationLevel: 0
psmSplashimage: {fileID: 0}
+ splashScreenBackgroundSourceLandscape: {fileID: 0}
+ splashScreenBackgroundSourcePortrait: {fileID: 0}
spritePackerPolicy:
+ webGLMemorySize: 256
+ webGLExceptionSupport: 1
+ webGLNameFilesAsHashes: 0
+ webGLDataCaching: 0
+ webGLDebugSymbols: 0
+ webGLEmscriptenArgs:
+ webGLModulesDirectory:
+ webGLTemplate: APPLICATION:Default
+ webGLAnalyzeBuildSize: 0
+ webGLUseEmbeddedResources: 0
+ webGLUseWasm: 0
+ webGLCompressionFormat: 1
scriptingDefineSymbols:
1:
+ platformArchitecture:
+ iOS: 2
+ scriptingBackend:
+ Android: 0
+ Metro: 2
+ Standalone: 0
+ WP8: 2
+ WebGL: 1
+ WebPlayer: 0
+ iOS: 1
+ incrementalIl2cppBuild:
+ iOS: 0
+ additionalIl2CppArgs:
+ scriptingRuntimeVersion: 0
+ apiCompatibilityLevelPerPlatform: {}
+ m_RenderingPath: 1
+ m_MobileRenderingPath: 1
metroPackageName: CocaineMountain
metroPackageVersion:
metroCertificatePath:
@@ -384,7 +628,9 @@ PlayerSettings:
tizenSigningProfileName:
tizenGPSPermissions: 0
tizenMicrophonePermissions: 0
- tizenMinOSVersion: 0
+ tizenDeploymentTarget:
+ tizenDeploymentTargetType: -1
+ tizenMinOSVersion: 1
n3dsUseExtSaveData: 0
n3dsCompressStaticMem: 1
n3dsExtSaveDataNumber: 0x12345
@@ -414,145 +660,36 @@ PlayerSettings:
XboxOnePackageEncryption: 0
XboxOnePackageUpdateGranularity: 2
XboxOneDescription:
+ XboxOneLanguage:
+ - enus
+ XboxOneCapability: []
+ XboxOneGameRating: {}
XboxOneIsContentPackage: 0
XboxOneEnableGPUVariability: 0
XboxOneSockets: {}
XboxOneSplashScreen: {fileID: 0}
XboxOneAllowedProductIds: []
XboxOnePersistentLocalStorageSize: 0
- intPropertyNames:
- - Android::ScriptingBackend
- - Metro::ScriptingBackend
- - Standalone::ScriptingBackend
- - WP8::ScriptingBackend
- - WebGL::ScriptingBackend
- - WebGL::audioCompressionFormat
- - WebGL::exceptionSupport
- - WebGL::memorySize
- - WebPlayer::ScriptingBackend
- - iOS::Architecture
- - iOS::EnableIncrementalBuildSupportForIl2cpp
- - iOS::ScriptingBackend
- Android::ScriptingBackend: 0
- Metro::ScriptingBackend: 2
- Standalone::ScriptingBackend: 0
- WP8::ScriptingBackend: 2
- WebGL::ScriptingBackend: 1
- WebGL::audioCompressionFormat: 4
- WebGL::exceptionSupport: 1
- WebGL::memorySize: 256
- WebPlayer::ScriptingBackend: 0
- iOS::Architecture: 2
- iOS::EnableIncrementalBuildSupportForIl2cpp: 0
- iOS::ScriptingBackend: 1
- boolPropertyNames:
- - Android::VR::enable
- - Metro::VR::enable
- - N3DS::VR::enable
- - PS3::VR::enable
- - PS4::VR::enable
- - PSM::VR::enable
- - PSP2::VR::enable
- - SamsungTV::VR::enable
- - Standalone::VR::enable
- - Tizen::VR::enable
- - WebGL::VR::enable
- - WebGL::analyzeBuildSize
- - WebGL::dataCaching
- - WebGL::useEmbeddedResources
- - WebPlayer::VR::enable
- - WiiU::VR::enable
- - Xbox360::VR::enable
- - XboxOne::VR::enable
- - XboxOne::enus
- - iOS::VR::enable
- - tvOS::VR::enable
- Android::VR::enable: 0
- Metro::VR::enable: 0
- N3DS::VR::enable: 0
- PS3::VR::enable: 0
- PS4::VR::enable: 0
- PSM::VR::enable: 0
- PSP2::VR::enable: 0
- SamsungTV::VR::enable: 0
- Standalone::VR::enable: 1
- Tizen::VR::enable: 0
- WebGL::VR::enable: 0
- WebGL::analyzeBuildSize: 0
- WebGL::dataCaching: 0
- WebGL::useEmbeddedResources: 0
- WebPlayer::VR::enable: 0
- WiiU::VR::enable: 0
- Xbox360::VR::enable: 0
- XboxOne::VR::enable: 0
- XboxOne::enus: 1
- iOS::VR::enable: 0
- tvOS::VR::enable: 0
- stringPropertyNames:
- - Analytics_ServiceEnabled::Analytics_ServiceEnabled
- - Build_ServiceEnabled::Build_ServiceEnabled
- - Collab_ServiceEnabled::Collab_ServiceEnabled
- - ErrorHub_ServiceEnabled::ErrorHub_ServiceEnabled
- - Game_Performance_ServiceEnabled::Game_Performance_ServiceEnabled
- - Hub_ServiceEnabled::Hub_ServiceEnabled
- - Purchasing_ServiceEnabled::Purchasing_ServiceEnabled
- - UNet_ServiceEnabled::UNet_ServiceEnabled
- - Unity_Ads_ServiceEnabled::Unity_Ads_ServiceEnabled
- - WebGL::emscriptenArgs
- - WebGL::template
- - additionalIl2CppArgs::additionalIl2CppArgs
- Analytics_ServiceEnabled::Analytics_ServiceEnabled: False
- Build_ServiceEnabled::Build_ServiceEnabled: False
- Collab_ServiceEnabled::Collab_ServiceEnabled: False
- ErrorHub_ServiceEnabled::ErrorHub_ServiceEnabled: False
- Game_Performance_ServiceEnabled::Game_Performance_ServiceEnabled: False
- Hub_ServiceEnabled::Hub_ServiceEnabled: False
- Purchasing_ServiceEnabled::Purchasing_ServiceEnabled: False
- UNet_ServiceEnabled::UNet_ServiceEnabled: False
- Unity_Ads_ServiceEnabled::Unity_Ads_ServiceEnabled: False
- WebGL::emscriptenArgs:
- WebGL::template: APPLICATION:Default
- additionalIl2CppArgs::additionalIl2CppArgs:
- vectorPropertyNames:
- - Android::VR::enabledDevices
- - Metro::VR::enabledDevices
- - N3DS::VR::enabledDevices
- - PS3::VR::enabledDevices
- - PS4::VR::enabledDevices
- - PSM::VR::enabledDevices
- - PSP2::VR::enabledDevices
- - SamsungTV::VR::enabledDevices
- - Standalone::VR::enabledDevices
- - Tizen::VR::enabledDevices
- - WebGL::VR::enabledDevices
- - WebPlayer::VR::enabledDevices
- - WiiU::VR::enabledDevices
- - Xbox360::VR::enabledDevices
- - XboxOne::VR::enabledDevices
- - iOS::VR::enabledDevices
- - tvOS::VR::enabledDevices
- Android::VR::enabledDevices:
- - Oculus
- Metro::VR::enabledDevices: []
- N3DS::VR::enabledDevices: []
- PS3::VR::enabledDevices: []
- PS4::VR::enabledDevices:
- - PlayStationVR
- PSM::VR::enabledDevices: []
- PSP2::VR::enabledDevices: []
- SamsungTV::VR::enabledDevices: []
- Standalone::VR::enabledDevices:
- - Oculus
- - OpenVR
- Tizen::VR::enabledDevices: []
- WebGL::VR::enabledDevices: []
- WebPlayer::VR::enabledDevices: []
- WiiU::VR::enabledDevices: []
- Xbox360::VR::enabledDevices: []
- XboxOne::VR::enabledDevices: []
- iOS::VR::enabledDevices: []
- tvOS::VR::enabledDevices: []
+ xboxOneScriptCompiler: 0
+ vrEditorSettings:
+ daydream:
+ daydreamIconForeground: {fileID: 0}
+ daydreamIconBackground: {fileID: 0}
+ cloudServicesEnabled:
+ Analytics: 0
+ Build: 0
+ Collab: 0
+ ErrorHub: 0
+ Game_Performance: 0
+ Hub: 0
+ Purchasing: 0
+ UNet: 0
+ Unity_Ads: 0
+ facebookSdkVersion: 7.9.4
+ apiCompatibilityLevel: 2
cloudProjectId:
projectName:
organizationId:
cloudEnabled: 0
+ enableNativePlatformBackendsForNewInputSystem: 0
+ disableOldInputManagerSupport: 0
diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt
index ae41cb69..7a6fffb8 100644
--- a/ProjectSettings/ProjectVersion.txt
+++ b/ProjectSettings/ProjectVersion.txt
@@ -1,2 +1 @@
-m_EditorVersion: 5.4.2f2
-m_StandardAssetsVersion: 0
+m_EditorVersion: 2017.2.0f3
diff --git a/ProjectSettings/UnityAdsSettings.asset b/ProjectSettings/UnityAdsSettings.asset
deleted file mode 100644
index 224050ce..00000000
--- a/ProjectSettings/UnityAdsSettings.asset
+++ /dev/null
@@ -1,11 +0,0 @@
-%YAML 1.1
-%TAG !u! tag:unity3d.com,2011:
---- !u!292 &1
-UnityAdsSettings:
- m_ObjectHideFlags: 0
- m_Enabled: 0
- m_InitializeOnStartup: 1
- m_TestMode: 0
- m_EnabledPlatforms: 4294967295
- m_IosGameId:
- m_AndroidGameId:
diff --git a/ProjectSettings/UnityConnectSettings.asset b/ProjectSettings/UnityConnectSettings.asset
index 9b7a5783..3da14d5b 100644
--- a/ProjectSettings/UnityConnectSettings.asset
+++ b/ProjectSettings/UnityConnectSettings.asset
@@ -3,6 +3,16 @@
--- !u!310 &1
UnityConnectSettings:
m_ObjectHideFlags: 0
+ m_Enabled: 0
+ m_TestMode: 0
+ m_TestEventUrl:
+ m_TestConfigUrl:
+ m_TestInitMode: 0
+ CrashReportingSettings:
+ m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes
+ m_NativeEventUrl: https://perf-events.cloud.unity3d.com/symbolicate
+ m_Enabled: 0
+ m_CaptureEditorExceptions: 1
UnityPurchasingSettings:
m_Enabled: 0
m_TestMode: 0
@@ -12,3 +22,13 @@ UnityConnectSettings:
m_TestMode: 0
m_TestEventUrl:
m_TestConfigUrl:
+ UnityAdsSettings:
+ m_Enabled: 0
+ m_InitializeOnStartup: 1
+ m_TestMode: 0
+ m_IosGameId:
+ m_AndroidGameId:
+ m_GameIds: {}
+ m_GameId:
+ PerformanceReportingSettings:
+ m_Enabled: 0
diff --git a/UnityPackageManager/manifest.json b/UnityPackageManager/manifest.json
new file mode 100644
index 00000000..526aca60
--- /dev/null
+++ b/UnityPackageManager/manifest.json
@@ -0,0 +1,4 @@
+{
+ "dependencies": {
+ }
+}