12345678910111213141516171819202122232425262728293031323334353637 |
- using UnityEngine;
- namespace SicknessReduction.Visual
- {
- public class VirtualNose : MonoBehaviour
- {
- public GameObject prefabToSpawn;
-
- private Camera cam;
- private bool camAvailable;
- private GameObject nose;
- private void Start()
- {
- cam = Camera.main;
- if (cam == null)
- {
- Debug.LogWarning("No main camera found. Cannot place virtual nose!");
- return;
- }
- else
- {
- camAvailable = true;
- }
- nose = Instantiate(prefabToSpawn, cam.transform);
- nose.transform.localPosition = Vector3.forward * cam.nearClipPlane;
- }
- private void Update()
- {
- //if (!camAvailable) return;
- //var camTransform = cam.transform;
- //transform.position = camTransform.position + camTransform.forward * cam.nearClipPlane * 1.03f;
- }
- }
- }
|