pull/6/head
marcgauch 2024-01-07 13:37:25 +01:00
parent af3b189dfc
commit 32bf8a2783
6 changed files with 92 additions and 8 deletions

35
Assets/Infoboard.cs Normal file
View File

@ -0,0 +1,35 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Infoboard : MonoBehaviour
{
public Transform target; // The OVRCameraRig transform
public float distanceInFront = 1.5f;
public float heightAbove = 0.5f;
private bool placed = false;
// Update is called once per frame
void Update()
{
if (placed) return;
if (target == null) return;
// Calculate the new position (1.5 units in front and 0.5 units above the ground)
Vector3 newPosition = target.position + target.forward * 2.5f + target.up * 0.5f;
// Set the position of this object
transform.position = newPosition;
// Face the target
transform.LookAt(target);
// Since a quad is used, you may need to adjust the rotation if it doesn't face correctly
transform.Rotate(Vector3.up, 180f); // Rotate by 180 degrees around the Y-axis
placed = true; // Set placed to true to ensure this only happens once
}
}

11
Assets/Infoboard.cs.meta Normal file
View File

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

View File

@ -2,10 +2,26 @@ using UnityEngine;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
public class Suicide : MonoBehaviour public class MyHead : MonoBehaviour
{ {
public Transform target; // The OVRCameraRig transform
void Update()
{
if (target != null)
{
// Set the position of this object to follow the OVRCameraRig
transform.position = target.position;
}
}
// This method is called when a collision occurs // This method is called when a collision occurs
// for the unfortunate event that a bullet hits the head collider
private void OnCollisionEnter(Collision collision) private void OnCollisionEnter(Collision collision)
{ {
// Check if the collision is with the specific object you want // Check if the collision is with the specific object you want

View File

@ -261,6 +261,7 @@ GameObject:
- component: {fileID: 853524358} - component: {fileID: 853524358}
- component: {fileID: 853524357} - component: {fileID: 853524357}
- component: {fileID: 853524356} - component: {fileID: 853524356}
- component: {fileID: 853524360}
m_Layer: 0 m_Layer: 0
m_Name: Quad m_Name: Quad
m_TagString: Untagged m_TagString: Untagged
@ -349,12 +350,27 @@ Transform:
m_GameObject: {fileID: 853524355} m_GameObject: {fileID: 853524355}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0.9, z: 1.75} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &853524360
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 853524355}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d329d6b208af22150b4bafbf50cea884, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 922082568}
distanceInFront: 2.5
heightAbove: 0.5
--- !u!1001 &922082564 --- !u!1001 &922082564
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -439,6 +455,11 @@ Transform:
m_CorrespondingSourceObject: {fileID: 482130, guid: 126d619cf4daa52469682f85c1378b4a, type: 3} m_CorrespondingSourceObject: {fileID: 482130, guid: 126d619cf4daa52469682f85c1378b4a, type: 3}
m_PrefabInstance: {fileID: 922082564} m_PrefabInstance: {fileID: 922082564}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!4 &922082568 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 400004, guid: 126d619cf4daa52469682f85c1378b4a, type: 3}
m_PrefabInstance: {fileID: 922082564}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1191604752 --- !u!1 &1191604752
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -2087,7 +2087,7 @@ MeshRenderer:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1369645932} m_GameObject: {fileID: 1369645932}
m_Enabled: 1 m_Enabled: 0
m_CastShadows: 1 m_CastShadows: 1
m_ReceiveShadows: 1 m_ReceiveShadows: 1
m_DynamicOccludee: 1 m_DynamicOccludee: 1
@ -2142,11 +2142,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b9763abf2ebe9a0058a5ca57fd60d20f, type: 3} m_Script: {fileID: 11500000, guid: b9763abf2ebe9a0058a5ca57fd60d20f, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
fadeDuration: 2 target: {fileID: 1560560408}
skybox: {fileID: 2100000, guid: 8138b2e64e964ba2ab05123d4940f482, type: 2}
sun: {fileID: 223974228}
fadeImage: {fileID: 0}
fadeSpeed: 0.5
--- !u!1 &1426203498 --- !u!1 &1426203498
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2453,6 +2449,11 @@ MeshFilter:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1504185302} m_GameObject: {fileID: 1504185302}
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1560560408 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 400002, guid: 126d619cf4daa52469682f85c1378b4a, type: 3}
m_PrefabInstance: {fileID: 1368183232}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1635660319 --- !u!1 &1635660319
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0