Added VR libraries

This commit is contained in:
Chris Midkiff
2018-10-08 23:54:11 -04:00
parent d9eb2a9763
commit 7ce1036e39
1037 changed files with 195630 additions and 348 deletions

View File

@@ -0,0 +1,51 @@
/************************************************************************************
Copyright : Copyright 2017-Present Oculus VR, LLC. All Rights reserved.
Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License");
you may not use the Oculus VR Rift SDK except in compliance with the License,
which is provided at the time of installation or download, or which
otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at
http://www.oculusvr.com/licenses/LICENSE-3.2
Unless required by applicable law or agreed to in writing, the Oculus VR SDK
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
************************************************************************************/
using UnityEngine;
using UnityEngine.SceneManagement;
public class BackButtonLogic : MonoBehaviour {
bool buttonPressed = false;
void Update() {
if (OVRInput.GetDown(OVRInput.Button.Back) || Input.GetKeyDown(KeyCode.Escape)) {
buttonPressed = true;
}
if (buttonPressed && (OVRInput.GetUp(OVRInput.Button.Back) || Input.GetKeyUp(KeyCode.Escape))) {
buttonPressed = false;
Scene scene = SceneManager.GetActiveScene();
if (scene.name == "main") {
#if UNITY_ANDROID && !UNITY_EDITOR
OVRManager.PlatformUIConfirmQuit();
#endif
}
else {
SceneManager.LoadScene("main", LoadSceneMode.Single);
}
}
if (OVRInput.GetUp(OVRInput.Button.Back) || Input.GetKeyUp(KeyCode.Escape)) {
buttonPressed = false;
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: c52963611592b1f4e850fc927ddad8c7
timeCreated: 1512508539
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,38 @@
/************************************************************************************
Copyright : Copyright 2017-Present Oculus VR, LLC. All Rights reserved.
Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License");
you may not use the Oculus VR Rift SDK except in compliance with the License,
which is provided at the time of installation or download, or which
otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at
http://www.oculusvr.com/licenses/LICENSE-3.2
Unless required by applicable law or agreed to in writing, the Oculus VR SDK
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
************************************************************************************/
using UnityEngine;
using UnityEngine.SceneManagement;
public class MainMenuInteraction : MonoBehaviour {
public void OnLoadUI() {
SceneManager.LoadScene("selection_ui", LoadSceneMode.Single);
}
public void OnLoadRaw() {
SceneManager.LoadScene("selection_raw", LoadSceneMode.Single);
}
public void OnLoadEvent() {
SceneManager.LoadScene("selection_physics", LoadSceneMode.Single);
}
public void OnLoadAllInOne() {
SceneManager.LoadScene("selection_all", LoadSceneMode.Single);
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8d0b8b3fa3583fa479057753e1cfa754
timeCreated: 1512379608
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,62 @@
/************************************************************************************
Copyright : Copyright 2017-Present Oculus VR, LLC. All Rights reserved.
Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License");
you may not use the Oculus VR Rift SDK except in compliance with the License,
which is provided at the time of installation or download, or which
otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at
http://www.oculusvr.com/licenses/LICENSE-3.2
Unless required by applicable law or agreed to in writing, the Oculus VR SDK
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
************************************************************************************/
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
namespace ControllerSelection {
public class PhysicsInteraction : MonoBehaviour {
public NavMeshAgent agent;
public const float navMeshSampleDistance = 4f;
public UnityEngine.UI.Text outText;
private void Awake() {
agent.updateRotation = false;
}
public void OnGroundClick(BaseEventData data) {
OVRRayPointerEventData pData = (OVRRayPointerEventData)data;
Vector3 destinationPosition = Vector3.zero;
NavMeshHit hit;
if (NavMesh.SamplePosition(pData.pointerCurrentRaycast.worldPosition, out hit, navMeshSampleDistance, NavMesh.AllAreas)) {
destinationPosition = hit.position;
}
else {
destinationPosition = pData.pointerCurrentRaycast.worldPosition;
}
agent.isStopped = true;
agent.SetDestination(destinationPosition);
agent.isStopped = false;
if (outText != null) {
outText.text = "<b>Last Interaction:</b>\nNavigate to: (" + destinationPosition.x + ", " + destinationPosition.y + ", " + destinationPosition.z + ")";
}
}
public void OnBackClick(BaseEventData data) {
SceneManager.LoadScene("main", LoadSceneMode.Single);
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 1189ca8b34bccff47bad0a297bd32791
timeCreated: 1512500256
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,66 @@
/************************************************************************************
Copyright : Copyright 2017-Present Oculus VR, LLC. All Rights reserved.
Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License");
you may not use the Oculus VR Rift SDK except in compliance with the License,
which is provided at the time of installation or download, or which
otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at
http://www.oculusvr.com/licenses/LICENSE-3.2
Unless required by applicable law or agreed to in writing, the Oculus VR SDK
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
************************************************************************************/
using UnityEngine;
using UnityEngine.SceneManagement;
public class RawInteraction : MonoBehaviour {
protected Material oldHoverMat;
public Material yellowMat;
public Material backIdle;
public Material backACtive;
public UnityEngine.UI.Text outText;
public void OnHoverEnter(Transform t) {
if (t.gameObject.name == "BackButton") {
t.gameObject.GetComponent<Renderer>().material = backACtive;
}
else {
oldHoverMat = t.gameObject.GetComponent<Renderer>().material;
t.gameObject.GetComponent<Renderer>().material = yellowMat;
}
if (outText != null) {
outText.text = "<b>Last Interaction:</b>\nHover Enter:" + t.gameObject.name;
}
}
public void OnHoverExit(Transform t) {
if (t.gameObject.name == "BackButton") {
t.gameObject.GetComponent<Renderer>().material = backIdle;
}
else {
t.gameObject.GetComponent<Renderer>().material = oldHoverMat;
}
if (outText != null) {
outText.text = "<b>Last Interaction:</b>\nHover Exit:" + t.gameObject.name;
}
}
public void OnSelected(Transform t) {
if (t.gameObject.name == "BackButton") {
SceneManager.LoadScene("main", LoadSceneMode.Single);
}
Debug.Log("Clicked on " + t.gameObject.name);
if (outText != null) {
outText.text = "<b>Last Interaction:</b>\nClicked On:" + t.gameObject.name;
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 43034b73b1ab62b409e7c11bfffd57ef
timeCreated: 1512379608
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,55 @@
/************************************************************************************
Copyright : Copyright 2017-Present Oculus VR, LLC. All Rights reserved.
Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License");
you may not use the Oculus VR Rift SDK except in compliance with the License,
which is provided at the time of installation or download, or which
otherwise accompanies this software in either electronic or hard copy form.
You may obtain a copy of the License at
http://www.oculusvr.com/licenses/LICENSE-3.2
Unless required by applicable law or agreed to in writing, the Oculus VR SDK
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
************************************************************************************/
using UnityEngine;
using UnityEngine.SceneManagement;
public class UIInteraction : MonoBehaviour {
public UnityEngine.UI.Text outText;
public void OnButtonClicked() {
if (outText != null) {
outText.text = "<b>Last Interaction:</b>\nUI Button clicked";
}
}
public void OnSliderChanged(float value) {
if (outText != null) {
outText.text = "<b>Last Interaction:</b>\nUI Slider value: " + value;
}
}
public void OnToggleChanged(bool value) {
if (outText != null) {
outText.text = "<b>Last Interaction:</b>\nUI toggle value: " + value;
}
}
public void OnClearText() {
if (outText != null) {
outText.text = "";
}
}
public void OnBackToMenu() {
SceneManager.LoadScene("main", LoadSceneMode.Single);
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 7a42657cd72591c449cf96836acc166c
timeCreated: 1512379608
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: