Added Custom & Oculus extensions
This commit is contained in:
parent
02329b3532
commit
ed750c012b
8
Runtime/HumanoidControl/Scripts/Extensions/Custom.meta
Normal file
8
Runtime/HumanoidControl/Scripts/Extensions/Custom.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 36ebb5083c03e91419dc11acc8fd6aa7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
209
Runtime/HumanoidControl/Scripts/Extensions/Custom/CustomArm.cs
Normal file
209
Runtime/HumanoidControl/Scripts/Extensions/Custom/CustomArm.cs
Normal file
@ -0,0 +1,209 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
using Passer.Tracking;
|
||||
|
||||
/// <summary>
|
||||
/// A custom sensor used on the arm of a humanoid
|
||||
/// </summary>
|
||||
/// This tracking option supports a custom developed ControllerComponent or HandSkeleton for the hand and/or arm.
|
||||
[System.Serializable]
|
||||
public class CustomArm : Passer.Humanoid.ArmSensor {
|
||||
|
||||
/// <summary>
|
||||
/// The name of this sensor
|
||||
/// </summary>
|
||||
public override string name => "Custom Sensor";
|
||||
|
||||
/// <summary>
|
||||
/// THe tracker for this sensor
|
||||
/// </summary>
|
||||
#if hCUSTOM
|
||||
public override HumanoidTracker tracker => humanoid.custom;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// The tracker controller to use for this arm
|
||||
/// </summary>
|
||||
protected ControllerComponent controllerComponent;
|
||||
|
||||
/// <summary>
|
||||
/// The bone on the arm controlled by the sensor
|
||||
/// </summary>
|
||||
public ArmBones attachedBone = ArmBones.Hand;
|
||||
|
||||
/// <summary>
|
||||
/// The controller input for this humanoid
|
||||
/// </summary>
|
||||
protected Controller controllerInput;
|
||||
|
||||
#region Manage
|
||||
|
||||
/// <summary>
|
||||
/// Updates the arm targets based on the current sensor position and rotation
|
||||
/// </summary>
|
||||
public override void SetSensor2Target() {
|
||||
if (sensorComponent == null)
|
||||
return;
|
||||
|
||||
HumanoidTarget.TargetedBone targetBone = handTarget.GetTargetBone(attachedBone);
|
||||
if (targetBone == null)
|
||||
return;
|
||||
|
||||
sensor2TargetRotation = Quaternion.Inverse(sensorComponent.transform.rotation) * targetBone.target.transform.rotation;
|
||||
sensor2TargetPosition = -targetBone.target.transform.InverseTransformPoint(sensorComponent.transform.position);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the sensor position and rotation based on the current position of the arm targets.
|
||||
/// </summary>
|
||||
/// <param name="_">Not used</param>
|
||||
public override void UpdateSensorTransformFromTarget(Transform _) {
|
||||
if (handTarget == null)
|
||||
return;
|
||||
|
||||
HumanoidTarget.TargetedBone targetBone = handTarget.GetTargetBone(attachedBone);
|
||||
base.UpdateSensorTransformFromTarget(targetBone.target.transform);
|
||||
}
|
||||
|
||||
#endregion Manage
|
||||
|
||||
#region Start
|
||||
|
||||
/// <summary>
|
||||
/// Prepares the arm for tracking with the tracked controller and/or skeleton
|
||||
/// </summary>
|
||||
/// <param name="_humanoid">The humanoid for which this arm is tracked</param>
|
||||
/// <param name="targetTransform">The transform of the hand target</param>
|
||||
/// This will find and initialize the controllerInput for the given humanoid.
|
||||
/// It will initialize the sensor2TargetPosition and sensor2TargetRotation values.
|
||||
/// It will determine whether the sensor should be shown and rendered.
|
||||
/// It will start the tracking for the controller and/or hand skeleton.
|
||||
public override void Start(HumanoidControl _humanoid, Transform targetTransform) {
|
||||
base.Start(_humanoid, targetTransform);
|
||||
|
||||
if (tracker == null || !tracker.enabled || !enabled)
|
||||
return;
|
||||
|
||||
controllerComponent = sensorComponent as ControllerComponent;
|
||||
controllerInput = Controllers.GetController(0);
|
||||
|
||||
handSkeleton = sensorComponent as HandSkeleton;
|
||||
|
||||
SetSensor2Target();
|
||||
ShowSensor(handTarget.humanoid.showRealObjects && target.showRealObjects);
|
||||
|
||||
if (controllerComponent != null) {
|
||||
if (tracker.trackerComponent != null)
|
||||
controllerComponent.StartComponent(tracker.trackerComponent.transform, handTarget.isLeft);
|
||||
else
|
||||
controllerComponent.StartComponent(controllerComponent.transform.parent, handTarget.isLeft);
|
||||
}
|
||||
if (handSkeleton != null) {
|
||||
if (tracker.trackerComponent != null)
|
||||
handSkeleton.StartComponent(tracker.trackerComponent.transform);
|
||||
else
|
||||
handSkeleton.StartComponent(handSkeleton.transform.parent);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Start
|
||||
|
||||
#region Update
|
||||
|
||||
/// <summary>
|
||||
/// Updates the arm target based on the status of the tracked controller and/or skeleton
|
||||
/// </summary>
|
||||
public override void Update() {
|
||||
status = Tracker.Status.Unavailable;
|
||||
if (tracker == null || !tracker.enabled || !enabled)
|
||||
return;
|
||||
|
||||
if (sensorComponent == null)
|
||||
return;
|
||||
|
||||
sensorComponent.UpdateComponent();
|
||||
status = sensorComponent.status;
|
||||
if (status != Tracker.Status.Tracking)
|
||||
return;
|
||||
|
||||
HumanoidTarget.TargetedBone targetBone = handTarget.GetTargetBone(attachedBone);
|
||||
|
||||
UpdateTarget(targetBone.target, sensorComponent);
|
||||
|
||||
UpdateControllerInput();
|
||||
|
||||
UpdateHandFromSkeleton();
|
||||
}
|
||||
|
||||
#region Controller
|
||||
|
||||
/// <summary>
|
||||
/// Updates the Controller Input for this side
|
||||
/// </summary>
|
||||
protected void UpdateControllerInput() {
|
||||
if (handTarget.isLeft)
|
||||
UpdateControllerInput(controllerInput.left);
|
||||
else
|
||||
UpdateControllerInput(controllerInput.right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates one side of the ControllerInput from the values of the tracked ControllerComponent
|
||||
/// </summary>
|
||||
/// <param name="controllerSide">The controller side to update</param>
|
||||
/// This function does nothing when the controller is not available or not tracking.
|
||||
protected virtual void UpdateControllerInput(ControllerSide controllerSide) {
|
||||
if (controllerSide == null)
|
||||
return;
|
||||
|
||||
if (controllerComponent == null || controllerComponent.status != Tracker.Status.Tracking)
|
||||
return;
|
||||
|
||||
controllerSide.stickHorizontal += controllerComponent.primaryAxis.x;
|
||||
controllerSide.stickVertical += controllerComponent.primaryAxis.y;
|
||||
controllerSide.stickButton |= (controllerComponent.primaryAxis.z > 0.5F);
|
||||
controllerSide.stickTouch = true;
|
||||
|
||||
controllerSide.buttons[0] |= controllerComponent.button1 > 0.5F;
|
||||
controllerSide.buttons[1] |= controllerComponent.button2 > 0.5F;
|
||||
controllerSide.buttons[2] |= controllerComponent.button3 > 0.5F;
|
||||
controllerSide.buttons[3] |= controllerComponent.button4 > 0.5F;
|
||||
|
||||
controllerSide.trigger1 += controllerComponent.trigger1;
|
||||
controllerSide.trigger2 += controllerComponent.trigger2;
|
||||
|
||||
controllerSide.option |= controllerComponent.option > 0.5F;
|
||||
}
|
||||
|
||||
#endregion Controller
|
||||
|
||||
#region Skeleton
|
||||
|
||||
/// <summary>
|
||||
/// This function uses the tracked HandSkeleton to update the pose of the hand
|
||||
/// </summary>
|
||||
/// This function does nothing when the hand skeleton is not available or not tracking.
|
||||
protected override void UpdateHandFromSkeleton() {
|
||||
if (handSkeleton == null || handSkeleton.status != Tracker.Status.Tracking)
|
||||
return;
|
||||
|
||||
Transform wristBone = handSkeleton.GetWristBone();
|
||||
handTarget.hand.target.transform.position = wristBone.transform.position;
|
||||
if (handTarget.isLeft)
|
||||
handTarget.hand.target.transform.rotation = wristBone.transform.rotation * Quaternion.Euler(-90, 0, 90);
|
||||
else
|
||||
handTarget.hand.target.transform.rotation = wristBone.transform.rotation * Quaternion.Euler(-90, 0, -90);
|
||||
|
||||
UpdateThumbFromSkeleton();
|
||||
UpdateIndexFingerFromSkeleton();
|
||||
UpdateMiddleFingerFromSkeleton();
|
||||
UpdateRingFingerFromSkeleton();
|
||||
UpdateLittleFingerFromSkeleton();
|
||||
}
|
||||
|
||||
#endregion Skeleton
|
||||
|
||||
#endregion Update
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b1d7b6728893ceb4bb7e73e43cace60b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,79 @@
|
||||
using UnityEngine;
|
||||
using Passer.Tracking;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
|
||||
/// <summary>
|
||||
/// A custom sensor used on the head of a humanoid.
|
||||
/// </summary>
|
||||
/// This tracking option supports a custom developed SensorComponent for the head.
|
||||
[System.Serializable]
|
||||
public class CustomHead : HeadSensor {
|
||||
public override string name => "Custom Sensor";
|
||||
|
||||
#if hCUSTOM
|
||||
public override HumanoidTracker tracker => humanoid.custom;
|
||||
#endif
|
||||
|
||||
//private static readonly Vector3 defaultLocalTrackerPosition = Vector3.zero;
|
||||
//private static readonly Quaternion defaultLocalTrackerRotation = Quaternion.identity;
|
||||
|
||||
#region Manage
|
||||
|
||||
#endregion Manage
|
||||
|
||||
#region Start
|
||||
|
||||
/// <summary>
|
||||
/// Prepares the head for tracking with the tracked sensor
|
||||
/// </summary>
|
||||
/// <param name="_humanoid">The humanoid for which this head is tracked</param>
|
||||
/// <param name="targetTransform">The transform of the head target</param>
|
||||
/// It will initialize the sensor2TargetPosition and sensor2TargetRotation values.
|
||||
/// It will determine whether the sensor should be shown and rendered.
|
||||
/// It will start the tracking of the sensor.
|
||||
public override void Start(HumanoidControl _humanoid, Transform targetTransform) {
|
||||
base.Start(_humanoid, targetTransform);
|
||||
|
||||
if (tracker == null || !tracker.enabled || !enabled)
|
||||
return;
|
||||
|
||||
SetSensor2Target();
|
||||
ShowSensor(headTarget.humanoid.showRealObjects && target.showRealObjects);
|
||||
|
||||
if (sensorComponent != null) {
|
||||
if (tracker.trackerComponent != null)
|
||||
sensorComponent.StartComponent(tracker.trackerComponent.transform);
|
||||
else
|
||||
sensorComponent.StartComponent(sensorComponent.transform.parent);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Start
|
||||
|
||||
#region Update
|
||||
|
||||
/// <summary>
|
||||
/// Updates the head target based on the status of the tracke sensor
|
||||
/// </summary>
|
||||
public override void Update() {
|
||||
status = Tracker.Status.Unavailable;
|
||||
if (tracker == null || !tracker.enabled || !enabled)
|
||||
return;
|
||||
|
||||
if (sensorComponent == null)
|
||||
return;
|
||||
|
||||
sensorComponent.UpdateComponent();
|
||||
status = sensorComponent.status;
|
||||
if (status != Tracker.Status.Tracking)
|
||||
return;
|
||||
|
||||
UpdateTarget(headTarget.head.target, sensorComponent);
|
||||
|
||||
UpdateNeckTargetFromHead();
|
||||
}
|
||||
|
||||
#endregion Update
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 33addd0b8cb0bbb41b80554896116e1e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
105
Runtime/HumanoidControl/Scripts/Extensions/Custom/CustomLeg.cs
Normal file
105
Runtime/HumanoidControl/Scripts/Extensions/Custom/CustomLeg.cs
Normal file
@ -0,0 +1,105 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
using Passer.Tracking;
|
||||
|
||||
/// <summary>
|
||||
/// A custom sensor used on the leg of a humanoid.
|
||||
/// </summary>
|
||||
/// This tracking option supports a custom developed SensorComponent on the leg or foot.
|
||||
[System.Serializable]
|
||||
public class CustomLeg : LegSensor {
|
||||
|
||||
public override string name => "Custom Sensor";
|
||||
|
||||
/// <summary>
|
||||
/// The bone on the leg controlled by the sensor
|
||||
/// </summary>
|
||||
public LegBones attachedBone = LegBones.Foot;
|
||||
|
||||
#if hCUSTOM
|
||||
public override HumanoidTracker tracker => humanoid.custom;
|
||||
#endif
|
||||
|
||||
#region Manage
|
||||
|
||||
/// <summary>
|
||||
/// Updates the leg targets based on the current sensor position and rotation
|
||||
/// </summary>
|
||||
public override void SetSensor2Target() {
|
||||
if (sensorComponent == null)
|
||||
return;
|
||||
|
||||
HumanoidTarget.TargetedBone targetBone = footTarget.GetTargetBone(attachedBone);
|
||||
if (targetBone == null)
|
||||
return;
|
||||
|
||||
sensor2TargetRotation = Quaternion.Inverse(sensorComponent.transform.rotation) * targetBone.target.transform.rotation;
|
||||
sensor2TargetPosition = -targetBone.target.transform.InverseTransformPoint(sensorComponent.transform.position);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the sensor position and rotation based on the current position of the leg targets
|
||||
/// </summary>
|
||||
/// <param name="_">Not used</param>
|
||||
public override void UpdateSensorTransformFromTarget(Transform _) {
|
||||
HumanoidTarget.TargetedBone targetBone = footTarget.GetTargetBone(attachedBone);
|
||||
base.UpdateSensorTransformFromTarget(targetBone.target.transform);
|
||||
}
|
||||
|
||||
#endregion Manage
|
||||
|
||||
#region Start
|
||||
|
||||
/// <summary>
|
||||
/// Prepares the leg for tracking with the sensor
|
||||
/// </summary>
|
||||
/// <param name="_humanoid">The humanoid for which this leg is tracked</param>
|
||||
/// <param name="targetTransform">The transform of the foot target</param>
|
||||
/// It will initialze the sensor2TargetPosition and sensor2TargetRotation values.
|
||||
/// It will determine whether the sensor should be shown and rendered.
|
||||
/// It will start the tracking of the sensor.
|
||||
public override void Start(HumanoidControl _humanoid, Transform targetTransform) {
|
||||
base.Start(_humanoid, targetTransform);
|
||||
|
||||
SetSensor2Target();
|
||||
ShowSensor(footTarget.humanoid.showRealObjects && target.showRealObjects);
|
||||
|
||||
if (sensorComponent != null) {
|
||||
if (tracker.trackerComponent != null)
|
||||
sensorComponent.StartComponent(tracker.trackerComponent.transform);
|
||||
else
|
||||
sensorComponent.StartComponent(sensorComponent.transform.parent);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Start
|
||||
|
||||
#region Update
|
||||
|
||||
/// <summary>
|
||||
/// Updates the leg target based on the status of the tracked sensor
|
||||
/// </summary>
|
||||
public override void Update() {
|
||||
status = Tracker.Status.Unavailable;
|
||||
if (tracker == null || !tracker.enabled || !enabled)
|
||||
return;
|
||||
|
||||
if (sensorComponent == null)
|
||||
return;
|
||||
|
||||
sensorComponent.UpdateComponent();
|
||||
status = sensorComponent.status;
|
||||
if (status != Tracker.Status.Tracking)
|
||||
return;
|
||||
|
||||
HumanoidTarget.TargetedBone targetBone = footTarget.GetTargetBone(attachedBone);
|
||||
|
||||
UpdateTarget(targetBone.target, sensorComponent);
|
||||
}
|
||||
|
||||
#endregion Update
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb5d7cb45eac0e6468fa4b91fc6a1480
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
105
Runtime/HumanoidControl/Scripts/Extensions/Custom/CustomTorso.cs
Normal file
105
Runtime/HumanoidControl/Scripts/Extensions/Custom/CustomTorso.cs
Normal file
@ -0,0 +1,105 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
using Passer.Tracking;
|
||||
|
||||
/// <summary>
|
||||
/// A custom sensor used on the torso of a humanoid.
|
||||
/// </summary>
|
||||
/// This tracking option supports a custom developed SensorComponent for the torso.
|
||||
[System.Serializable]
|
||||
public class CustomTorso : TorsoSensor {
|
||||
|
||||
public override string name => "Custom Sensor";
|
||||
|
||||
#if hCUSTOM
|
||||
public override HumanoidTracker tracker => humanoid.custom;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// The bone on the torso controlled by the sensor
|
||||
/// </summary>
|
||||
public TorsoBones attachedBone = TorsoBones.Hips;
|
||||
|
||||
#region Manage
|
||||
|
||||
/// <summary>
|
||||
/// Updates the torso targets based on the current sensor position and rotation
|
||||
/// </summary>
|
||||
public override void SetSensor2Target() {
|
||||
if (sensorComponent == null)
|
||||
return;
|
||||
|
||||
HumanoidTarget.TargetedBone targetBone = hipsTarget.GetTargetBone(attachedBone);
|
||||
if (targetBone == null)
|
||||
return;
|
||||
|
||||
sensor2TargetRotation = Quaternion.Inverse(sensorComponent.transform.rotation) * targetBone.target.transform.rotation;
|
||||
sensor2TargetPosition = -targetBone.target.transform.InverseTransformPoint(sensorComponent.transform.position);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the sensor position and rotation based on the current position of the torso targets
|
||||
/// </summary>
|
||||
/// <param name="_">Not used</param>
|
||||
public override void UpdateSensorTransformFromTarget(Transform _) {
|
||||
HumanoidTarget.TargetedBone targetBone = hipsTarget.GetTargetBone(attachedBone);
|
||||
base.UpdateSensorTransformFromTarget(targetBone.target.transform);
|
||||
}
|
||||
|
||||
#endregion Manage
|
||||
|
||||
#region Start
|
||||
|
||||
/// <summary>
|
||||
/// Prepares the torso for tracking with the sensor
|
||||
/// </summary>
|
||||
/// <param name="_humanoid">The humanoid for which this torso is tracked</param>
|
||||
/// <param name="targetTransform">The transform of the hips target</param>
|
||||
/// It will initialze the sensor2TargetPosition and sensor2TargetRotation values.
|
||||
/// It will determine whether the sensor should be shown and rendered.
|
||||
/// It will start the tracking of the sensor.
|
||||
public override void Start(HumanoidControl _humanoid, Transform targetTransform) {
|
||||
base.Start(_humanoid, targetTransform);
|
||||
|
||||
SetSensor2Target();
|
||||
ShowSensor(hipsTarget.humanoid.showRealObjects && target.showRealObjects);
|
||||
|
||||
if (sensorComponent != null) {
|
||||
if (tracker.trackerComponent != null)
|
||||
sensorComponent.StartComponent(tracker.trackerComponent.transform);
|
||||
else
|
||||
sensorComponent.StartComponent(sensorComponent.transform.parent);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Start
|
||||
|
||||
#region Update
|
||||
|
||||
/// <summary>
|
||||
/// Updates the torso targets based on the status of the tracked sensor
|
||||
/// </summary>
|
||||
public override void Update() {
|
||||
status = Tracker.Status.Unavailable;
|
||||
if (tracker == null || !tracker.enabled || !enabled)
|
||||
return;
|
||||
|
||||
if (sensorComponent == null)
|
||||
return;
|
||||
|
||||
sensorComponent.UpdateComponent();
|
||||
status = sensorComponent.status;
|
||||
if (status != Tracker.Status.Tracking)
|
||||
return;
|
||||
|
||||
HumanoidTarget.TargetedBone targetBone = hipsTarget.GetTargetBone(attachedBone);
|
||||
|
||||
UpdateTarget(targetBone.target, sensorComponent);
|
||||
|
||||
}
|
||||
|
||||
#endregion Update
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0a97dd438bd4674fb64e76753a4bbc9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,116 @@
|
||||
using Passer.Tracking;
|
||||
|
||||
namespace Passer.Humanoid {
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A tracker wich can be used for custom tracking solutions
|
||||
/// </summary>
|
||||
/// THis tracking option supports custom trackers and sensors for a humanoid.
|
||||
[System.Serializable]
|
||||
public class CustomTracker : HumanoidTracker {
|
||||
|
||||
/// \copydoc HumanoidTracker::name
|
||||
public override string name => "Custom Tracker";
|
||||
|
||||
#region Manage
|
||||
|
||||
/// <summary>
|
||||
/// A skeleton for the body
|
||||
/// </summary>
|
||||
/// When this is set, the tracking will be taken from this skeleton
|
||||
public BodySkeleton bodySkeleton;
|
||||
|
||||
#endregion Manage
|
||||
|
||||
#region Update
|
||||
|
||||
public override void UpdateTracker() {
|
||||
base.UpdateTracker();
|
||||
|
||||
if (bodySkeleton != null) {
|
||||
status = bodySkeleton.status;
|
||||
|
||||
UpdateBodyFromSkeleton();
|
||||
}
|
||||
}
|
||||
|
||||
protected void UpdateBodyFromSkeleton() {
|
||||
if (bodySkeleton == null || bodySkeleton.status != Tracker.Status.Tracking)
|
||||
return;
|
||||
|
||||
UpdateTorso();
|
||||
UpdateLeftArm();
|
||||
UpdateRightArm();
|
||||
UpdateLeftLeg();
|
||||
UpdateRightLeg();
|
||||
|
||||
humanoid.CopyRigToTargets();
|
||||
}
|
||||
|
||||
protected virtual void UpdateTorso() {
|
||||
UpdateBone(humanoid.hipsTarget.hips.target, Tracking.Bone.Hips);
|
||||
UpdateBoneRotation(humanoid.hipsTarget.spine.target, Tracking.Bone.Spine);
|
||||
UpdateBoneRotation(humanoid.hipsTarget.chest.target, Tracking.Bone.Chest);
|
||||
UpdateBoneRotation(humanoid.headTarget.head.target, Tracking.Bone.Head);
|
||||
}
|
||||
|
||||
protected virtual void UpdateLeftArm() {
|
||||
UpdateBoneRotation(humanoid.leftHandTarget.shoulder.target, Tracking.Bone.LeftShoulder);
|
||||
UpdateBoneRotation(humanoid.leftHandTarget.upperArm.target, Tracking.Bone.LeftUpperArm);
|
||||
UpdateBoneRotation(humanoid.leftHandTarget.forearm.target, Tracking.Bone.LeftForearm);
|
||||
UpdateBoneRotation(humanoid.leftHandTarget.hand.target, Tracking.Bone.LeftHand);
|
||||
}
|
||||
|
||||
protected virtual void UpdateRightArm() {
|
||||
UpdateBoneRotation(humanoid.rightHandTarget.shoulder.target, Tracking.Bone.RightShoulder);
|
||||
UpdateBoneRotation(humanoid.rightHandTarget.upperArm.target, Tracking.Bone.RightUpperArm);
|
||||
UpdateBoneRotation(humanoid.rightHandTarget.forearm.target, Tracking.Bone.RightForearm);
|
||||
UpdateBoneRotation(humanoid.rightHandTarget.hand.target, Tracking.Bone.RightHand);
|
||||
}
|
||||
|
||||
protected virtual void UpdateLeftLeg() {
|
||||
UpdateBoneRotation(humanoid.leftFootTarget.upperLeg.target, Tracking.Bone.LeftUpperLeg);
|
||||
UpdateBoneRotation(humanoid.leftFootTarget.lowerLeg.target, Tracking.Bone.LeftLowerLeg);
|
||||
UpdateBoneRotation(humanoid.leftFootTarget.foot.target, Tracking.Bone.LeftFoot);
|
||||
}
|
||||
|
||||
protected virtual void UpdateRightLeg() {
|
||||
UpdateBoneRotation(humanoid.rightFootTarget.upperLeg.target, Tracking.Bone.RightUpperLeg);
|
||||
UpdateBoneRotation(humanoid.rightFootTarget.lowerLeg.target, Tracking.Bone.RightLowerLeg);
|
||||
UpdateBoneRotation(humanoid.rightFootTarget.foot.target, Tracking.Bone.RightFoot);
|
||||
}
|
||||
|
||||
private void UpdateBone(HumanoidTarget.TargetTransform target, Tracking.Bone boneId) {
|
||||
TrackedBone trackedBone = bodySkeleton.GetBone(boneId);
|
||||
if (trackedBone == null)
|
||||
return;
|
||||
|
||||
float confidence = trackedBone.rotationConfidence;
|
||||
if (confidence > 0) {
|
||||
target.confidence.rotation = confidence;
|
||||
target.transform.rotation = bodySkeleton.transform.rotation * trackedBone.transform.rotation;
|
||||
}
|
||||
|
||||
confidence = trackedBone.positionConfidence;
|
||||
if (confidence > 0) {
|
||||
target.confidence.position = confidence;
|
||||
target.transform.position = bodySkeleton.transform.TransformPoint(trackedBone.transform.position);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateBoneRotation(HumanoidTarget.TargetTransform target, Tracking.Bone boneId) {
|
||||
TrackedBone trackedBone = bodySkeleton.GetBone(boneId);
|
||||
if (trackedBone == null)
|
||||
return;
|
||||
|
||||
float confidence = trackedBone.rotationConfidence;
|
||||
if (confidence > 0) {
|
||||
target.confidence.rotation = confidence;
|
||||
target.transform.rotation = bodySkeleton.transform.rotation * trackedBone.transform.rotation;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Update
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a17001cc5e526574f94bf4961b36c64a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
9
Runtime/HumanoidControl/Scripts/Extensions/Oculus.meta
Normal file
9
Runtime/HumanoidControl/Scripts/Extensions/Oculus.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5d6f8e7a6e99d0444b2d51573a7ef8fa
|
||||
folderAsset: yes
|
||||
timeCreated: 1472626649
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88b72ecc7f08a2543950b600aad6ae0a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
@ -0,0 +1,97 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab7fa14a16d2d4d46a58646bef481bfc
|
||||
ModelImporter:
|
||||
serializedVersion: 19301
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
materials:
|
||||
materialImportMode: 1
|
||||
materialName: 0
|
||||
materialSearch: 1
|
||||
materialLocation: 1
|
||||
animations:
|
||||
legacyGenerateAnimations: 4
|
||||
bakeSimulation: 0
|
||||
resampleCurves: 1
|
||||
optimizeGameObjects: 0
|
||||
motionNodeName:
|
||||
rigImportErrors:
|
||||
rigImportWarnings:
|
||||
animationImportErrors:
|
||||
animationImportWarnings:
|
||||
animationRetargetingWarnings:
|
||||
animationDoRetargetingWarnings: 0
|
||||
importAnimatedCustomProperties: 0
|
||||
importConstraints: 0
|
||||
animationCompression: 1
|
||||
animationRotationError: 0.5
|
||||
animationPositionError: 0.5
|
||||
animationScaleError: 0.5
|
||||
animationWrapMode: 0
|
||||
extraExposedTransformPaths: []
|
||||
extraUserProperties: []
|
||||
clipAnimations: []
|
||||
isReadable: 0
|
||||
meshes:
|
||||
lODScreenPercentages: []
|
||||
globalScale: 1
|
||||
meshCompression: 0
|
||||
addColliders: 0
|
||||
useSRGBMaterialColor: 1
|
||||
sortHierarchyByName: 1
|
||||
importVisibility: 1
|
||||
importBlendShapes: 1
|
||||
importCameras: 1
|
||||
importLights: 1
|
||||
fileIdsGeneration: 2
|
||||
swapUVChannels: 0
|
||||
generateSecondaryUV: 0
|
||||
useFileUnits: 1
|
||||
keepQuads: 0
|
||||
weldVertices: 1
|
||||
preserveHierarchy: 0
|
||||
skinWeightsMode: 0
|
||||
maxBonesPerVertex: 4
|
||||
minBoneWeight: 0.001
|
||||
meshOptimizationFlags: -1
|
||||
indexFormat: 0
|
||||
secondaryUVAngleDistortion: 8
|
||||
secondaryUVAreaDistortion: 15.000001
|
||||
secondaryUVHardAngle: 88
|
||||
secondaryUVPackMargin: 4
|
||||
useFileScale: 1
|
||||
tangentSpace:
|
||||
normalSmoothAngle: 60
|
||||
normalImportMode: 0
|
||||
tangentImportMode: 3
|
||||
normalCalculationMode: 4
|
||||
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
|
||||
blendShapeNormalImportMode: 1
|
||||
normalSmoothingSource: 0
|
||||
referencedClips: []
|
||||
importAnimation: 1
|
||||
humanDescription:
|
||||
serializedVersion: 3
|
||||
human: []
|
||||
skeleton: []
|
||||
armTwist: 0.5
|
||||
foreArmTwist: 0.5
|
||||
upperLegTwist: 0.5
|
||||
legTwist: 0.5
|
||||
armStretch: 0.05
|
||||
legStretch: 0.05
|
||||
feetSpacing: 0
|
||||
globalScale: 1
|
||||
rootMotionBoneName:
|
||||
hasTranslationDoF: 0
|
||||
hasExtraRoot: 0
|
||||
skeletonHasParents: 1
|
||||
lastHumanDescriptionAvatarSource: {instanceID: 0}
|
||||
autoGenerateAvatarMappingIfUnspecified: 1
|
||||
animationType: 2
|
||||
humanoidOversampling: 1
|
||||
avatarSetup: 0
|
||||
additionalBone: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2c77587d2814bad4a9ffe3b544de6df9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4a2726a32de8b234d953bcc51778579d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
@ -0,0 +1,92 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 196a35482dee8af47bede1110e5238d3
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
wrapU: -1
|
||||
wrapV: -1
|
||||
wrapW: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
@ -0,0 +1,92 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74344c43925f4b84e99b2ffd9d85c035
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
wrapU: -1
|
||||
wrapV: -1
|
||||
wrapW: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,77 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: body
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 2800000, guid: 196a35482dee8af47bede1110e5238d3, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc4ce78998ea26f49ae2822739896d1f
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,78 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: gloss
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords: _ALPHAPREMULTIPLY_ON
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: 3000
|
||||
stringTagMap:
|
||||
RenderType: Transparent
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 2800000, guid: 196a35482dee8af47bede1110e5238d3, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 10
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 3
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 0
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81d6471de7ed0204a98dd3ca034c3292
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
@ -0,0 +1,97 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 58377a2584075f6419ab14f150c33273
|
||||
ModelImporter:
|
||||
serializedVersion: 19301
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
materials:
|
||||
materialImportMode: 1
|
||||
materialName: 0
|
||||
materialSearch: 1
|
||||
materialLocation: 1
|
||||
animations:
|
||||
legacyGenerateAnimations: 4
|
||||
bakeSimulation: 0
|
||||
resampleCurves: 1
|
||||
optimizeGameObjects: 0
|
||||
motionNodeName:
|
||||
rigImportErrors:
|
||||
rigImportWarnings:
|
||||
animationImportErrors:
|
||||
animationImportWarnings:
|
||||
animationRetargetingWarnings:
|
||||
animationDoRetargetingWarnings: 0
|
||||
importAnimatedCustomProperties: 0
|
||||
importConstraints: 0
|
||||
animationCompression: 1
|
||||
animationRotationError: 0.5
|
||||
animationPositionError: 0.5
|
||||
animationScaleError: 0.5
|
||||
animationWrapMode: 0
|
||||
extraExposedTransformPaths: []
|
||||
extraUserProperties: []
|
||||
clipAnimations: []
|
||||
isReadable: 0
|
||||
meshes:
|
||||
lODScreenPercentages: []
|
||||
globalScale: 1
|
||||
meshCompression: 0
|
||||
addColliders: 0
|
||||
useSRGBMaterialColor: 1
|
||||
sortHierarchyByName: 1
|
||||
importVisibility: 1
|
||||
importBlendShapes: 1
|
||||
importCameras: 1
|
||||
importLights: 1
|
||||
fileIdsGeneration: 2
|
||||
swapUVChannels: 0
|
||||
generateSecondaryUV: 0
|
||||
useFileUnits: 1
|
||||
keepQuads: 0
|
||||
weldVertices: 1
|
||||
preserveHierarchy: 0
|
||||
skinWeightsMode: 0
|
||||
maxBonesPerVertex: 4
|
||||
minBoneWeight: 0.001
|
||||
meshOptimizationFlags: -1
|
||||
indexFormat: 0
|
||||
secondaryUVAngleDistortion: 8
|
||||
secondaryUVAreaDistortion: 15.000001
|
||||
secondaryUVHardAngle: 88
|
||||
secondaryUVPackMargin: 4
|
||||
useFileScale: 1
|
||||
tangentSpace:
|
||||
normalSmoothAngle: 60
|
||||
normalImportMode: 0
|
||||
tangentImportMode: 3
|
||||
normalCalculationMode: 4
|
||||
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
|
||||
blendShapeNormalImportMode: 1
|
||||
normalSmoothingSource: 0
|
||||
referencedClips: []
|
||||
importAnimation: 1
|
||||
humanDescription:
|
||||
serializedVersion: 3
|
||||
human: []
|
||||
skeleton: []
|
||||
armTwist: 0.5
|
||||
foreArmTwist: 0.5
|
||||
upperLegTwist: 0.5
|
||||
legTwist: 0.5
|
||||
armStretch: 0.05
|
||||
legStretch: 0.05
|
||||
feetSpacing: 0
|
||||
globalScale: 1
|
||||
rootMotionBoneName:
|
||||
hasTranslationDoF: 0
|
||||
hasExtraRoot: 0
|
||||
skeletonHasParents: 1
|
||||
lastHumanDescriptionAvatarSource: {instanceID: 0}
|
||||
autoGenerateAvatarMappingIfUnspecified: 1
|
||||
animationType: 2
|
||||
humanoidOversampling: 1
|
||||
avatarSetup: 0
|
||||
additionalBone: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
314
Runtime/HumanoidControl/Scripts/Extensions/Oculus/Oculus.cs
Normal file
314
Runtime/HumanoidControl/Scripts/Extensions/Oculus/Oculus.cs
Normal file
@ -0,0 +1,314 @@
|
||||
using UnityEngine;
|
||||
using Passer.Humanoid;
|
||||
|
||||
namespace Passer.Tracking {
|
||||
|
||||
/// <summary>
|
||||
/// The Oculus Device
|
||||
/// </summary>
|
||||
public class Oculus : TrackerComponent {
|
||||
#if hOCULUS
|
||||
public bool persistentTracking;
|
||||
public RealWorldConfiguration realWorldConfiguration;
|
||||
|
||||
#region Manage
|
||||
/*
|
||||
/// <summary>
|
||||
/// Find an Oculus Tracker
|
||||
/// </summary>
|
||||
/// <param name="parentTransform"></param>
|
||||
/// <returns></returns>
|
||||
public static OculusTracker Find(Transform parentTransform) {
|
||||
OculusTracker oculus = parentTransform.GetComponentInChildren<OculusTracker>();
|
||||
if (oculus != null)
|
||||
return oculus;
|
||||
|
||||
oculus = FindObjectOfType<OculusTracker>();
|
||||
return oculus;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find or create a new Oculus Tracker
|
||||
/// </summary>
|
||||
/// <param name="parentTransform"></param>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="rotation"></param>
|
||||
/// <returns></returns>
|
||||
public static OculusTracker Get(Transform parentTransform, Vector3 position, Quaternion rotation) {
|
||||
OculusTracker oculus = Find(parentTransform);
|
||||
if (oculus != null)
|
||||
return oculus;
|
||||
|
||||
if (Application.isPlaying) {
|
||||
Debug.LogError("Oculus is missing");
|
||||
return null;
|
||||
}
|
||||
#if UNITY_EDITOR
|
||||
GameObject trackerObj = new GameObject("Oculus");
|
||||
Transform trackerTransform = trackerObj.transform;
|
||||
|
||||
trackerTransform.parent = parentTransform;
|
||||
trackerTransform.position = position;
|
||||
trackerTransform.rotation = rotation;
|
||||
|
||||
oculus = trackerTransform.gameObject.AddComponent<OculusTracker>();
|
||||
oculus.realWorld = parentTransform;
|
||||
|
||||
#endif
|
||||
return oculus;
|
||||
}
|
||||
*/
|
||||
#if hOCHAND
|
||||
public HandSkeleton FindHandTrackingSkeleton(bool isLeft) {
|
||||
HandSkeleton[] handSkeletons = GetComponentsInChildren<OculusHandSkeleton>();
|
||||
foreach (HandSkeleton handSkeleton in handSkeletons) {
|
||||
if (handSkeleton.isLeft == isLeft)
|
||||
return handSkeleton;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public HandSkeleton leftHandSkeleton {
|
||||
get { return FindHandTrackingSkeleton(true); }
|
||||
}
|
||||
public HandSkeleton rightHandSkeleton {
|
||||
get { return FindHandTrackingSkeleton(false); }
|
||||
}
|
||||
#endif
|
||||
public override void ShowSkeleton(bool shown) {
|
||||
#if hOCHAND
|
||||
if (leftHandSkeleton != null)
|
||||
leftHandSkeleton.show = shown;
|
||||
if (rightHandSkeleton != null)
|
||||
rightHandSkeleton.show = shown;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find an Oculus tracker
|
||||
/// </summary>
|
||||
/// <param name="parentTransform">The parent transform of the tracker</param>
|
||||
/// <returns>The tracker</returns>
|
||||
public static Oculus Find(Transform parentTransform) {
|
||||
Oculus oculus = parentTransform.GetComponentInChildren<Oculus>();
|
||||
if (oculus != null)
|
||||
return oculus;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find or create a new SteamVR tracker
|
||||
/// </summary>
|
||||
/// <param name="parentTransform">The parent transform for the tracker</param>
|
||||
/// <param name="position">The world position of the tracker</param>
|
||||
/// <param name="rotation">The world rotation of the tracker</param>
|
||||
/// <returns>The tracker</returns>
|
||||
public static Oculus Get(Transform parentTransform, Vector3 position, Quaternion rotation) {
|
||||
Oculus oculus = Find(parentTransform);
|
||||
if (oculus == null) {
|
||||
GameObject trackerObj = new GameObject(nameof(Oculus));
|
||||
Transform trackerTransform = trackerObj.transform;
|
||||
|
||||
trackerTransform.parent = parentTransform;
|
||||
trackerTransform.position = position;
|
||||
trackerTransform.rotation = rotation;
|
||||
|
||||
oculus = trackerObj.AddComponent<Oculus>();
|
||||
oculus.realWorld = parentTransform;
|
||||
}
|
||||
return oculus;
|
||||
}
|
||||
|
||||
#region Hmd
|
||||
|
||||
protected OculusHmd _hmd;
|
||||
public OculusHmd hmd {
|
||||
get {
|
||||
if (_hmd != null)
|
||||
return _hmd;
|
||||
|
||||
_hmd = this.GetComponentInChildren<OculusHmd>();
|
||||
if (_hmd != null)
|
||||
return _hmd;
|
||||
|
||||
_hmd = FindObjectOfType<OculusHmd>();
|
||||
return _hmd;
|
||||
}
|
||||
}
|
||||
|
||||
public OculusHmd GetHmd(Vector3 position, Quaternion rotation) {
|
||||
if (hmd == null) {
|
||||
GameObject sensorObj = new GameObject("Hmd");
|
||||
Transform sensorTransform = sensorObj.transform;
|
||||
|
||||
sensorTransform.parent = this.transform;
|
||||
sensorTransform.position = position;
|
||||
sensorTransform.rotation = rotation;
|
||||
|
||||
_hmd = sensorTransform.gameObject.AddComponent<OculusHmd>();
|
||||
|
||||
_hmd.unityCamera = _hmd.GetComponent<Camera>();
|
||||
if (_hmd.unityCamera == null) {
|
||||
_hmd.unityCamera = _hmd.gameObject.AddComponent<Camera>();
|
||||
_hmd.unityCamera.nearClipPlane = 0.05F;
|
||||
|
||||
_hmd.gameObject.AddComponent<AudioListener>();
|
||||
}
|
||||
AddScreenFader(_hmd.unityCamera);
|
||||
}
|
||||
|
||||
return _hmd;
|
||||
}
|
||||
|
||||
protected static void AddScreenFader(Camera camera) {
|
||||
if (camera == null)
|
||||
return;
|
||||
|
||||
Transform planeTransform = camera.transform.Find("Fader");
|
||||
if (planeTransform != null)
|
||||
return;
|
||||
|
||||
GameObject plane = GameObject.CreatePrimitive(PrimitiveType.Plane);
|
||||
plane.transform.name = "Fader";
|
||||
plane.transform.parent = camera.transform;
|
||||
plane.transform.localEulerAngles = new Vector3(-90, 0, 0);
|
||||
plane.transform.localPosition = new Vector3(0, 0, camera.nearClipPlane + 0.01F);
|
||||
|
||||
Renderer renderer = plane.GetComponent<Renderer>();
|
||||
if (renderer != null) {
|
||||
Shader fadeShader = Shader.Find("Standard");
|
||||
Material fadeMaterial = new Material(fadeShader);
|
||||
fadeMaterial.name = "FadeMaterial";
|
||||
fadeMaterial.SetFloat("_Mode", 2);
|
||||
fadeMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
|
||||
fadeMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
|
||||
fadeMaterial.SetInt("_ZWrite", 0);
|
||||
fadeMaterial.DisableKeyword("_ALPHATEST_ON");
|
||||
fadeMaterial.EnableKeyword("_ALPHABLEND_ON");
|
||||
fadeMaterial.DisableKeyword("_ALPHAPREMULTIPLY_ON");
|
||||
fadeMaterial.renderQueue = 3000;
|
||||
Color color = Color.black;
|
||||
color.a = 0.0F;
|
||||
fadeMaterial.SetColor("_Color", new Color(0, 0, 0, 0));
|
||||
renderer.material = fadeMaterial;
|
||||
renderer.enabled = false;
|
||||
}
|
||||
|
||||
Collider c = plane.GetComponent<Collider>();
|
||||
Object.DestroyImmediate(c);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Controller
|
||||
|
||||
/// <summary>
|
||||
/// Find an OpenVR Controller
|
||||
/// </summary>
|
||||
/// <param name="isLeft">Looking for the left-handed controller?</param>
|
||||
/// <returns>The controller or null when it has not been found</returns>
|
||||
public OculusController FindController(bool isLeft) {
|
||||
OculusController[] controllers = GetComponentsInChildren<OculusController>();
|
||||
foreach (OculusController controller in controllers) {
|
||||
if (controller.isLeft == isLeft)
|
||||
return controller;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public OculusController GetController(bool isLeft, Vector3 position, Quaternion rotation) {
|
||||
OculusController controller = FindController(isLeft);
|
||||
if (controller == null) {
|
||||
GameObject controllerObject = new GameObject(isLeft ? "Left Oculus Controller" : "Right Oculus Controller");
|
||||
Transform controllerTransform = controllerObject.transform;
|
||||
|
||||
controllerTransform.parent = this.transform;
|
||||
controllerTransform.position = position;
|
||||
controllerTransform.rotation = rotation;
|
||||
|
||||
controller = controllerObject.AddComponent<OculusController>();
|
||||
controller.tracker = this;
|
||||
controller.isLeft = isLeft;
|
||||
|
||||
string prefabLeftName = "Left Touch Controller";
|
||||
string prefabRightName = "Right Touch Controller";
|
||||
string resourceName = isLeft ? prefabLeftName : prefabRightName;
|
||||
Object controllerPrefab = Resources.Load(resourceName);
|
||||
if (controllerPrefab != null) {
|
||||
GameObject sensorObject = (GameObject)Object.Instantiate(controllerPrefab);
|
||||
sensorObject.transform.parent = controllerTransform;
|
||||
sensorObject.transform.localPosition = Vector3.zero;
|
||||
sensorObject.transform.localRotation = Quaternion.identity;
|
||||
}
|
||||
else
|
||||
Debug.LogWarning("Oculus Controller model could not be found in the Resources");
|
||||
}
|
||||
return controller;
|
||||
}
|
||||
|
||||
#endregion Controller
|
||||
|
||||
#endregion
|
||||
|
||||
#region Start
|
||||
|
||||
protected override void Start() {
|
||||
base.Start();
|
||||
|
||||
OculusDevice.Start();
|
||||
}
|
||||
/*
|
||||
protected override void Start() {
|
||||
if (!persistentTracking)
|
||||
transform.localPosition = new Vector3(0, Humanoid.Tracking.OculusDevice.eyeHeight, 0);
|
||||
}
|
||||
|
||||
protected virtual void OnEnable() {
|
||||
if (!persistentTracking)
|
||||
return;
|
||||
|
||||
if (realWorldConfiguration == null) {
|
||||
Debug.LogError("Could not find Real World Configuration");
|
||||
return;
|
||||
}
|
||||
|
||||
RealWorldConfiguration.TrackingSpace trackingSpace =
|
||||
realWorldConfiguration.trackers.Find(space => space.trackerId == TrackerId.Oculus);
|
||||
|
||||
if (trackingSpace == null)
|
||||
return;
|
||||
|
||||
transform.position = trackingSpace.position;
|
||||
transform.rotation = trackingSpace.rotation;
|
||||
}
|
||||
|
||||
protected virtual void OnDestroy() {
|
||||
if (!persistentTracking)
|
||||
return;
|
||||
|
||||
if (realWorldConfiguration == null) {
|
||||
Debug.LogError("Could not find Real World Configuration");
|
||||
return;
|
||||
}
|
||||
|
||||
RealWorldConfiguration.TrackingSpace trackingSpace =
|
||||
realWorldConfiguration.trackers.Find(space => space.trackerId == TrackerId.Oculus);
|
||||
|
||||
if (trackingSpace == null) {
|
||||
trackingSpace = new RealWorldConfiguration.TrackingSpace();
|
||||
realWorldConfiguration.trackers.Add(trackingSpace);
|
||||
}
|
||||
trackingSpace.position = transform.position;
|
||||
trackingSpace.rotation = transform.rotation;
|
||||
}
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 57a3d484a71616f4aab0563d70ea65ef
|
||||
timeCreated: 1557221210
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,176 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Passer.Tracking {
|
||||
using Passer.Humanoid;
|
||||
using Passer.Humanoid.Tracking;
|
||||
|
||||
/// <summary>
|
||||
/// An Oculus controller
|
||||
/// </summary>
|
||||
// Base this on UnityXRController in the future?
|
||||
public class OculusController : ControllerComponent {
|
||||
#if hOCULUS
|
||||
public TrackerComponent tracker;
|
||||
|
||||
//public bool isLeft;
|
||||
|
||||
//public Vector3 joystick;
|
||||
//public float indexTrigger;
|
||||
//public float handTrigger;
|
||||
//public float buttonAX;
|
||||
//public float buttonBY;
|
||||
//public float option;
|
||||
//public float thumbrest;
|
||||
|
||||
public bool positionalTracking = true;
|
||||
|
||||
public override bool show {
|
||||
set {
|
||||
if (value == true && !_show) {
|
||||
Renderer[] renderers = this.GetComponentsInChildren<Renderer>();
|
||||
foreach (Renderer renderer in renderers) {
|
||||
if (!(renderer is LineRenderer))
|
||||
renderer.enabled = true;
|
||||
}
|
||||
|
||||
_show = true;
|
||||
}
|
||||
else if (value == false && _show) {
|
||||
Renderer[] renderers = this.GetComponentsInChildren<Renderer>();
|
||||
foreach (Renderer renderer in renderers) {
|
||||
if (!(renderer is LineRenderer))
|
||||
renderer.enabled = false;
|
||||
}
|
||||
|
||||
_show = false;
|
||||
}
|
||||
}
|
||||
get {
|
||||
return _show;
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateComponent() {
|
||||
status = Tracker.Status.Tracking;
|
||||
if (OculusDevice.status == Tracker.Status.Unavailable)
|
||||
status = Tracker.Status.Unavailable;
|
||||
|
||||
if (trackerTransform == null)
|
||||
trackerTransform = this.trackerTransform.parent;
|
||||
|
||||
Sensor.ID sensorID = isLeft ? Sensor.ID.LeftHand : Sensor.ID.RightHand;
|
||||
|
||||
if (OculusDevice.GetRotationalConfidence(sensorID) == 0)
|
||||
status = Tracker.Status.Present;
|
||||
|
||||
if (status == Tracker.Status.Present || status == Tracker.Status.Unavailable) {
|
||||
positionConfidence = 0;
|
||||
rotationConfidence = 0;
|
||||
//gameObject.SetActive(false);
|
||||
show = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3 localSensorPosition = HumanoidTarget.ToVector3(OculusDevice.GetPosition(sensorID));
|
||||
transform.position = trackerTransform.TransformPoint(localSensorPosition);
|
||||
|
||||
Quaternion localSensorRotation = HumanoidTarget.ToQuaternion(OculusDevice.GetRotation(sensorID));
|
||||
transform.rotation = trackerTransform.rotation * localSensorRotation;
|
||||
|
||||
positionConfidence = OculusDevice.GetPositionalConfidence(sensorID);
|
||||
rotationConfidence = OculusDevice.GetRotationalConfidence(sensorID);
|
||||
//gameObject.SetActive(true);
|
||||
show = true;
|
||||
|
||||
UpdateInput(sensorID);
|
||||
}
|
||||
|
||||
private void UpdateInput(Sensor.ID sensorID) {
|
||||
switch (sensorID) {
|
||||
case Sensor.ID.LeftHand:
|
||||
UpdateLeftInput();
|
||||
return;
|
||||
case Sensor.ID.RightHand:
|
||||
UpdateRightInput();
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateLeftInput() {
|
||||
OculusDevice.Controller controllerMask;
|
||||
|
||||
#if !UNITY_EDITOR
|
||||
if (!positionalTracking)
|
||||
controllerMask = OculusDevice.Controller.LTrackedRemote;
|
||||
else
|
||||
#endif
|
||||
controllerMask = OculusDevice.Controller.LTouch;
|
||||
|
||||
OculusDevice.ControllerState4 controllerState = OculusDevice.GetControllerState(controllerMask);
|
||||
|
||||
float stickButton =
|
||||
OculusDevice.GetStickPress(controllerState) ? 1 : (
|
||||
OculusDevice.GetStickTouch(controllerState) ? 0 : -1);
|
||||
primaryAxis = new Vector3(
|
||||
OculusDevice.GetHorizontalStick(controllerState, true),
|
||||
OculusDevice.GetVerticalStick(controllerState, true),
|
||||
stickButton);
|
||||
|
||||
trigger1 = OculusDevice.GetTrigger1(controllerState, true);
|
||||
trigger2 = OculusDevice.GetTrigger2(controllerState, true);
|
||||
|
||||
button1 =
|
||||
OculusDevice.GetButton1Press(controllerState) ? 1 : (
|
||||
OculusDevice.GetButton1Touch(controllerState) ? 0 : -1);
|
||||
button2 =
|
||||
OculusDevice.GetButton2Press(controllerState) ? 1 : (
|
||||
OculusDevice.GetButton2Touch(controllerState) ? 0 : -1);
|
||||
button3 =
|
||||
OculusDevice.GetThumbRest(controllerState) ? 0 : -1;
|
||||
option =
|
||||
OculusDevice.GetButtonOptionPress(controllerState) ? 1 : 0;
|
||||
}
|
||||
|
||||
private void UpdateRightInput() {
|
||||
OculusDevice.Controller controllerMask;
|
||||
#if !UNITY_EDITOR
|
||||
if (!positionalTracking)
|
||||
controllerMask = OculusDevice.Controller.RTrackedRemote;
|
||||
else
|
||||
#endif
|
||||
controllerMask = OculusDevice.Controller.RTouch;
|
||||
|
||||
OculusDevice.ControllerState4 controllerState = OculusDevice.GetControllerState(controllerMask);
|
||||
|
||||
float stickButton =
|
||||
OculusDevice.GetStickPress(controllerState) ? 1 : (
|
||||
OculusDevice.GetStickTouch(controllerState) ? 0 : -1);
|
||||
primaryAxis = new Vector3(
|
||||
OculusDevice.GetHorizontalStick(controllerState, false),
|
||||
OculusDevice.GetVerticalStick(controllerState, false),
|
||||
stickButton);
|
||||
|
||||
trigger1 = OculusDevice.GetTrigger1(controllerState, false);
|
||||
trigger2 = OculusDevice.GetTrigger2(controllerState, false);
|
||||
|
||||
button1 =
|
||||
OculusDevice.GetButton1Press(controllerState) ? 1 : (
|
||||
OculusDevice.GetButton1Touch(controllerState) ? 0 : -1);
|
||||
button2 =
|
||||
OculusDevice.GetButton2Press(controllerState) ? 1 : (
|
||||
OculusDevice.GetButton2Touch(controllerState) ? 0 : -1);
|
||||
option =
|
||||
0;
|
||||
button3 =
|
||||
OculusDevice.GetThumbRest(controllerState) ? 0 : -1;
|
||||
}
|
||||
|
||||
public void Vibrate(float length, float strength) {
|
||||
Sensor.ID sensorID = isLeft ? Sensor.ID.LeftHand : Sensor.ID.RightHand;
|
||||
OculusDevice.Vibrate(sensorID, length, strength);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6235e438f770bf44285b28080c623d34
|
||||
timeCreated: 1536227072
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
1079
Runtime/HumanoidControl/Scripts/Extensions/Oculus/OculusDevice.cs
Normal file
1079
Runtime/HumanoidControl/Scripts/Extensions/Oculus/OculusDevice.cs
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d2084571fbdffea4c96208bf6dd9fc4b
|
||||
timeCreated: 1497033524
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,122 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Passer.Tracking {
|
||||
using Passer.Humanoid.Tracking;
|
||||
|
||||
/// <summary>
|
||||
/// A hand from Oculus hand tracking
|
||||
/// </summary>
|
||||
public class OculusHandSkeleton : HandSkeleton {
|
||||
|
||||
#if hOCHAND
|
||||
|
||||
private OculusDevice.HandState handState = new OculusDevice.HandState();
|
||||
|
||||
#region Manage
|
||||
|
||||
public static OculusHandSkeleton Find(Transform trackerTransform, bool isLeft) {
|
||||
OculusHandSkeleton[] handSkeletons = trackerTransform.GetComponentsInChildren<OculusHandSkeleton>();
|
||||
foreach (OculusHandSkeleton handSkeleton in handSkeletons) {
|
||||
if (handSkeleton.isLeft == isLeft)
|
||||
return handSkeleton;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static OculusHandSkeleton Get(Transform trackerTransform, bool isLeft) {
|
||||
OculusHandSkeleton handSkeleton = Find(trackerTransform, isLeft);
|
||||
if (handSkeleton == null) {
|
||||
GameObject skeletonObj = new GameObject(isLeft ? "Left Hand Skeleton" : "Right Hand Skeleton");
|
||||
skeletonObj.transform.parent = trackerTransform;
|
||||
skeletonObj.transform.localPosition = Vector3.zero;
|
||||
skeletonObj.transform.localRotation = Quaternion.identity;
|
||||
|
||||
handSkeleton = skeletonObj.AddComponent<OculusHandSkeleton>();
|
||||
handSkeleton.isLeft = isLeft;
|
||||
}
|
||||
return handSkeleton;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Start
|
||||
|
||||
protected override void InitializeSkeleton() {
|
||||
OculusDevice.Skeleton skeleton;
|
||||
if (OculusDevice.GetSkeleton(isLeft, out skeleton)) {
|
||||
|
||||
bones = new List<TrackedBone>(new TrackedBone[skeleton.NumBones]);
|
||||
|
||||
// pre-populate bones list before attempting to apply bone hierarchy
|
||||
for (int i = 0; i < skeleton.NumBones; ++i) {
|
||||
OculusDevice.BoneId id = (OculusDevice.BoneId)skeleton.Bones[i].Id;
|
||||
Vector3 pos = skeleton.Bones[i].Pose.Position.ToVector3();
|
||||
Quaternion rot = skeleton.Bones[i].Pose.Orientation.ToQuaternion();
|
||||
|
||||
bones[i] = TrackedBone.Create(id.ToString(), null);
|
||||
bones[i].transform.localPosition = pos;
|
||||
bones[i].transform.localRotation = rot;
|
||||
}
|
||||
|
||||
// Now apply bone hierarchy
|
||||
for (int i = 0; i < skeleton.NumBones; i++) {
|
||||
if (((OculusDevice.BoneId)skeleton.Bones[i].ParentBoneIndex) == OculusDevice.BoneId.Invalid)
|
||||
bones[i].transform.SetParent(this.transform, false);
|
||||
else
|
||||
bones[i].transform.SetParent(bones[skeleton.Bones[i].ParentBoneIndex].transform, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Update
|
||||
private Quaternion orientationCorrection;
|
||||
|
||||
public override void UpdateComponent() {
|
||||
base.UpdateComponent();
|
||||
|
||||
if (bones == null)
|
||||
InitializeSkeleton();
|
||||
if (bones == null) {
|
||||
status = Tracker.Status.Unavailable;
|
||||
DisableRenderer();
|
||||
return;
|
||||
}
|
||||
|
||||
if (OculusDevice.GetHandState(OculusDevice.Step.Render, isLeft ? OculusDevice.Hand.HandLeft : OculusDevice.Hand.HandRight, ref handState)) {
|
||||
if (handState.Status == 0) {
|
||||
status = Tracker.Status.Present;
|
||||
DisableRenderer();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
status = Tracker.Status.Tracking;
|
||||
this.transform.position = trackerTransform.TransformPoint(handState.RootPose.Position.ToVector3());
|
||||
this.transform.rotation = trackerTransform.rotation * handState.RootPose.Orientation.ToQuaternion();
|
||||
this.positionConfidence = 0.9F;
|
||||
this.rotationConfidence = 0.9F;
|
||||
}
|
||||
for (int i = 0; i < bones.Count; i++)
|
||||
bones[i].transform.localRotation = handState.BoneRotations[i].ToQuaternion();
|
||||
}
|
||||
else {
|
||||
status = Tracker.Status.Present;
|
||||
DisableRenderer();
|
||||
return;
|
||||
}
|
||||
|
||||
EnableRenderer();
|
||||
UpdateSkeletonRender();
|
||||
}
|
||||
|
||||
public override int GetBoneId(Finger finger, FingerBone fingerBone) {
|
||||
OculusDevice.BoneId boneId = OculusDevice.GetBoneId(finger, fingerBone);
|
||||
return (int)boneId;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endif
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 82ebe6b5f7e4a8b498b7c3c2e50fa997
|
||||
timeCreated: 1578586092
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
125
Runtime/HumanoidControl/Scripts/Extensions/Oculus/OculusHmd.cs
Normal file
125
Runtime/HumanoidControl/Scripts/Extensions/Oculus/OculusHmd.cs
Normal file
@ -0,0 +1,125 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Passer.Tracking {
|
||||
using Humanoid.Tracking;
|
||||
|
||||
/// <summary>
|
||||
/// The Oculus Head Mounted Device
|
||||
/// </summary>
|
||||
public class OculusHmd : SensorComponent {
|
||||
|
||||
public Camera unityCamera;
|
||||
#if hOCULUS
|
||||
|
||||
private Humanoid.Tracking.Sensor.ID sensorId = Humanoid.Tracking.Sensor.ID.Head;
|
||||
|
||||
bool wasTracking = true;
|
||||
Vector3 lastTrackingPosition;
|
||||
|
||||
#region Start
|
||||
|
||||
/// <summary>
|
||||
/// Find the Oculus Hmd
|
||||
/// </summary>
|
||||
/// <param name="oculusTransform"></param>
|
||||
/// <returns></returns>
|
||||
public static OculusHmd FindHmd(Transform oculusTransform) {
|
||||
OculusHmd[] tags = oculusTransform.GetComponentsInChildren<OculusHmd>();
|
||||
if (tags.Length > 0)
|
||||
return tags[0];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>Find or Create a new Antilatency Sensor</summary>
|
||||
public static OculusHmd Get(Transform oculusTransform, Vector3 position, Quaternion rotation) {
|
||||
if (oculusTransform == null)
|
||||
return null;
|
||||
|
||||
OculusHmd hmd = FindHmd(oculusTransform);
|
||||
if (hmd == null) {
|
||||
GameObject sensorObject = new GameObject("Oculus HMD");
|
||||
Transform sensorTransform = sensorObject.transform;
|
||||
|
||||
sensorTransform.parent = oculusTransform.transform;
|
||||
sensorTransform.position = position;
|
||||
sensorTransform.rotation = rotation;
|
||||
|
||||
hmd = sensorTransform.gameObject.AddComponent<OculusHmd>();
|
||||
//hmd.oculus = oculus;
|
||||
}
|
||||
return hmd;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Update
|
||||
|
||||
public override void UpdateComponent() {
|
||||
if (OculusDevice.GetRotationalConfidence(sensorId) == 0) {
|
||||
status = OculusDevice.IsPresent(0) ? Tracker.Status.Present : Tracker.Status.Unavailable;
|
||||
positionConfidence = 0;
|
||||
rotationConfidence = 0;
|
||||
gameObject.SetActive(false);
|
||||
OculusDevice.positionalTracking = false;
|
||||
wasTracking = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!OculusDevice.userPresent) {
|
||||
status = Tracker.Status.Present;
|
||||
positionConfidence = 0;
|
||||
rotationConfidence = 0;
|
||||
gameObject.SetActive(false);
|
||||
OculusDevice.positionalTracking = false;
|
||||
wasTracking = false;
|
||||
return;
|
||||
}
|
||||
|
||||
OculusDevice.positionalTracking = true;
|
||||
if (!wasTracking)
|
||||
ResetTrackingPosition();
|
||||
|
||||
status = Tracker.Status.Tracking;
|
||||
|
||||
Vector3 localPosition = Humanoid.HumanoidTarget.ToVector3(OculusDevice.GetPosition(sensorId));
|
||||
Quaternion localRotation = Humanoid.HumanoidTarget.ToQuaternion(OculusDevice.GetRotation(sensorId));
|
||||
transform.position = trackerTransform.TransformPoint(localPosition);
|
||||
transform.rotation = trackerTransform.rotation * localRotation;
|
||||
|
||||
positionConfidence = OculusDevice.GetPositionalConfidence(sensorId);
|
||||
rotationConfidence = OculusDevice.GetRotationalConfidence(sensorId);
|
||||
gameObject.SetActive(true);
|
||||
|
||||
FuseWithUnityCamera();
|
||||
|
||||
wasTracking = true;
|
||||
lastTrackingPosition = transform.position;
|
||||
}
|
||||
|
||||
protected virtual void FuseWithUnityCamera() {
|
||||
if (Camera.main == null)
|
||||
return;
|
||||
|
||||
Vector3 deltaPos = Camera.main.transform.position - transform.position;
|
||||
if (deltaPos.sqrMagnitude > 0.00001) {
|
||||
Camera.main.transform.parent.position -= deltaPos;
|
||||
}
|
||||
}
|
||||
|
||||
// Reset tracking position to the last position when it was tracking
|
||||
// This is needed to prevent the camera/avatar move while the headset is off
|
||||
// But then the tracking origin changes while you probably want to have it fixed
|
||||
// (that is: repeatable).
|
||||
protected virtual void ResetTrackingPosition() {
|
||||
if (lastTrackingPosition.sqrMagnitude == 0)
|
||||
return;
|
||||
|
||||
Vector3 deltaPos = Camera.main.transform.position - lastTrackingPosition;
|
||||
trackerTransform.position -= deltaPos;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endif
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dd3d72f0140b14b409d9414461439116
|
||||
timeCreated: 1536136694
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,55 @@
|
||||
namespace Passer.Humanoid {
|
||||
/// \page OculusDoc Meta/Oculus
|
||||
///
|
||||
/// Oculus Rift and Quest are supported using the \ref UnityXRTracker "UnityXR" component.
|
||||
/// This pages gives additional specific information for using the Oculus devices
|
||||
///
|
||||
/// Unity XR Plugin
|
||||
/// ===============
|
||||
/// Oculus devices can be used with both the Oculus and OpenXR plugin for Unity XR.
|
||||
/// However, it should be mentioned that hand tracking with the Oculus Quest is only
|
||||
/// supported using the Oculus plugin.
|
||||
///
|
||||
/// Hand%Tracking (Plus & Pro)
|
||||
/// ==========================
|
||||
/// For hand tracking, make sure the Unity XR plugin is set to Oculus.
|
||||
/// Hand tracking is currently not supported for OpenXR.
|
||||
/// When the platform is Android, an additional option will appear in the inspector
|
||||
/// \image html OculusHandTracking.png
|
||||
/// \image rtf OculusHandTracking.png
|
||||
///
|
||||
/// Please make sure that for hand tracking, ‘Use Hands’ is enabled in the
|
||||
/// Settings of the Oculus Quest itself or hand tracking will not work.
|
||||
///
|
||||
/// Controller Buttons
|
||||
/// ==================
|
||||
/// The buttons of the Oculus controller can be accessed using ControllerInput.
|
||||
/// The buttons are mapped as follows:
|
||||
///
|
||||
/// Left Controller
|
||||
/// ---------------
|
||||
///
|
||||
/// Button | ControllerInput
|
||||
/// ---------| --------
|
||||
/// X button | controller.left.button[0]
|
||||
/// Y button | controller.left.button[1]
|
||||
/// Thumbstick touch | controller.left.stickTouch
|
||||
/// Thumbstick press | controller.left.stickPress
|
||||
/// Thumbstick movements | controller.left.stickHorizontal & .stickVertical
|
||||
/// Index trigger | controller.left.trigger1
|
||||
/// Hand trigger | controller.left.trigger2
|
||||
/// Menu button | controller.left.option
|
||||
///
|
||||
/// Right Controller
|
||||
/// ----------------
|
||||
///
|
||||
/// Button | ControllerInput
|
||||
/// -------|-----------------
|
||||
/// A button | controller.right.button[0]
|
||||
/// B button | controller.right.button[1]
|
||||
/// Thumbstick touch | controller.right.stickTouch
|
||||
/// Thumbstick press | controller.right.stickPress
|
||||
/// Thumbstick movements | controller.right.stickHorizontal & .stickVertical
|
||||
/// Index trigger | controller.right.trigger1
|
||||
/// Hand trigger | controller.right.trigger2
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 291b0f046e30b1b40a1c43008404f1aa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:installLocation="auto">
|
||||
<!-- Request the headset DoF mode -->
|
||||
<application
|
||||
android:allowBackup="false">
|
||||
<activity
|
||||
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
|
||||
android:configChanges="locale|fontScale|keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode"
|
||||
android:launchMode="singleTask"
|
||||
android:name="com.unity3d.player.UnityPlayerActivity"
|
||||
android:excludeFromRecents="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="false" />
|
||||
</application>
|
||||
<uses-feature android:name="android.hardware.vr.headtracking" android:required="true" android:version="1" />
|
||||
<uses-permission android:name="oculus.permission.handtracking" />
|
||||
<uses-permission android:name="com.oculus.permission.HAND_TRACKING" />
|
||||
<uses-feature android:name="oculus.software.handtracking" android:required="false" />
|
||||
</manifest>
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69408a8f6035027499aba652fd716f25
|
||||
timeCreated: 1567755345
|
||||
licenseType: Free
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e34c89789a76b4429fd342bbe8a7f6b
|
||||
folderAsset: yes
|
||||
timeCreated: 1472986387
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,84 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1001 &100100000
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 1
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications: []
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 0}
|
||||
m_RootGameObject: {fileID: 1103073703406032}
|
||||
m_IsPrefabParent: 1
|
||||
--- !u!1 &1103073703406032
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 4808734570168326}
|
||||
- component: {fileID: 33781626903072926}
|
||||
- component: {fileID: 23539047341558740}
|
||||
m_Layer: 0
|
||||
m_Name: Left Quest Controller
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4808734570168326
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1103073703406032}
|
||||
m_LocalRotation: {x: 0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: -0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &23539047341558740
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1103073703406032}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: dc3b3568b7c54234f9d6a9f7297c3425, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!33 &33781626903072926
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1103073703406032}
|
||||
m_Mesh: {fileID: 4300000, guid: a533ecc148345874ca68507932792b9e, type: 3}
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0e0e467473c4c304691fb218ad5d5411
|
||||
timeCreated: 1562924722
|
||||
licenseType: Free
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,71 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1001 &6393815153189425683
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: -8679921383154817045, guid: ab7fa14a16d2d4d46a58646bef481bfc,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: ab7fa14a16d2d4d46a58646bef481bfc,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: ab7fa14a16d2d4d46a58646bef481bfc,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: ab7fa14a16d2d4d46a58646bef481bfc,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: ab7fa14a16d2d4d46a58646bef481bfc,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: ab7fa14a16d2d4d46a58646bef481bfc,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: ab7fa14a16d2d4d46a58646bef481bfc,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: ab7fa14a16d2d4d46a58646bef481bfc,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: ab7fa14a16d2d4d46a58646bef481bfc,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: ab7fa14a16d2d4d46a58646bef481bfc,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: ab7fa14a16d2d4d46a58646bef481bfc,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 919132149155446097, guid: ab7fa14a16d2d4d46a58646bef481bfc,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Left Touch Controller
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: ab7fa14a16d2d4d46a58646bef481bfc, type: 3}
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a23cce4874e0a54a83502ef5405163c
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,84 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1001 &100100000
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 1
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications: []
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 0}
|
||||
m_RootGameObject: {fileID: 1038420493408916}
|
||||
m_IsPrefabParent: 1
|
||||
--- !u!1 &1038420493408916
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 4210319229959686}
|
||||
- component: {fileID: 33256649974969318}
|
||||
- component: {fileID: 23472074526415768}
|
||||
m_Layer: 0
|
||||
m_Name: Right Quest Controller
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4210319229959686
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1038420493408916}
|
||||
m_LocalRotation: {x: 0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: -0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &23472074526415768
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1038420493408916}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: dc3b3568b7c54234f9d6a9f7297c3425, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!33 &33256649974969318
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1038420493408916}
|
||||
m_Mesh: {fileID: 4300000, guid: 6d5af71f44006e9478341b87a6c2867b, type: 3}
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f78c353d457baeb44987e0ae9bc0a529
|
||||
timeCreated: 1562924724
|
||||
licenseType: Free
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,71 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1001 &2748244689839952348
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: -8679921383154817045, guid: 58377a2584075f6419ab14f150c33273,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 58377a2584075f6419ab14f150c33273,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 58377a2584075f6419ab14f150c33273,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 58377a2584075f6419ab14f150c33273,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 58377a2584075f6419ab14f150c33273,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 58377a2584075f6419ab14f150c33273,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 58377a2584075f6419ab14f150c33273,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 58377a2584075f6419ab14f150c33273,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 58377a2584075f6419ab14f150c33273,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 58377a2584075f6419ab14f150c33273,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 58377a2584075f6419ab14f150c33273,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 919132149155446097, guid: 58377a2584075f6419ab14f150c33273,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Right Touch Controller
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 58377a2584075f6419ab14f150c33273, type: 3}
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 464a2f1ee1e88d94aa41de880913bd4f
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -9,16 +9,11 @@
|
||||
/// Main components
|
||||
/// ---------------
|
||||
/// * \ref HumanoidControl "Humanoid Control"
|
||||
/// * \ref Site "Humanoid Site"
|
||||
/// * \ref Visitor "Humanoid Visitor"
|
||||
///
|
||||
/// Devices
|
||||
/// -------
|
||||
/// * \ref UnityXRTracker "UnityXR"
|
||||
/// * \ref OculusDoc "Oculus"
|
||||
/// * \ref LeapTracker "Leap Motion"
|
||||
/// * \ref ViveTrackerDoc "Vive Tracker"
|
||||
/// * \ref NeuronTracker "Perception Neuron"
|
||||
///
|
||||
/// Input
|
||||
/// -----
|
||||
|
Loading…
x
Reference in New Issue
Block a user