private Vector3 GetPivotPositionInTrackerCoordinates() { if (useOculusPositionalTracking && OVRManager.tracker != null && OVRManager.tracker.isPositionTracked) { if (coordinateSystem && coordinateSystem.applyToRootCoordinates) { return(coordinateSystem.ConvertLocation(coordinateSystem.GetOculusRiftLocation(), RUISDevice.Oculus_DK2)); } else if (OVRManager.display != null) { return(OVRManager.display.GetHeadPose().position); } } else { switch (characterPivotType) { case CharacterPivotType.KinectHead: { if ((bodyTrackingDeviceID == RUISSkeletonManager.kinect2SensorID && !inputManager.enableKinect2) || (bodyTrackingDeviceID == RUISSkeletonManager.kinect1SensorID && !inputManager.enableKinect)) { break; } if (skeletonManager && skeletonManager.skeletons[bodyTrackingDeviceID, kinectPlayerId] != null) { if (skeletonController) // Add root speed scaling { return(Vector3.Scale(skeletonManager.skeletons[bodyTrackingDeviceID, kinectPlayerId].head.position, skeletonController.rootSpeedScaling)); } else { return(skeletonManager.skeletons[bodyTrackingDeviceID, kinectPlayerId].head.position); } } break; } case CharacterPivotType.KinectTorso: { if ((bodyTrackingDeviceID == RUISSkeletonManager.kinect2SensorID && !inputManager.enableKinect2) || (bodyTrackingDeviceID == RUISSkeletonManager.kinect1SensorID && !inputManager.enableKinect)) { break; } if (skeletonManager && skeletonManager.skeletons[bodyTrackingDeviceID, kinectPlayerId] != null) { if (skeletonController) // Add root speed scaling { return(Vector3.Scale(skeletonManager.skeletons[bodyTrackingDeviceID, kinectPlayerId].torso.position, skeletonController.rootSpeedScaling)); } else { return(skeletonManager.skeletons[bodyTrackingDeviceID, kinectPlayerId].torso.position); } } break; } case CharacterPivotType.MoveController: { if (!inputManager.enablePSMove) { break; } if (inputManager.GetMoveWand(moveControllerId)) { return(inputManager.GetMoveWand(moveControllerId).handlePosition); } break; } } } if (skeletonController != null) { return(skeletonController.transform.localPosition); } else { return(Vector3.zero); } }