35 lines
750 B
C#
35 lines
750 B
C#
|
using UnityEngine;
|
||
|
using UnityEngine.SceneManagement;
|
||
|
|
||
|
|
||
|
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
|
||
|
|
||
|
// for the unfortunate event that a bullet hits the head collider
|
||
|
private void OnCollisionEnter(Collision collision)
|
||
|
{
|
||
|
// Check if the collision is with the specific object you want
|
||
|
if (collision.gameObject.CompareTag("Bullet"))
|
||
|
{
|
||
|
SceneManager.LoadScene("AfterLife");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|