d540ec8a68
Co-Authored-By: MinaMaddahi <145911367+MinaMaddahi@users.noreply.github.com>
28 lines
780 B
C#
28 lines
780 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using Varjo.XR;
|
|
|
|
public class CameraPosition : MonoBehaviour
|
|
{
|
|
// Variable to store the locked Y position
|
|
private float lockedY;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
// Save the initial Y position as the locked position
|
|
lockedY = transform.position.y;
|
|
VarjoMixedReality.LockCameraConfig();
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void LateUpdate()
|
|
{
|
|
// Get the current position of the camera
|
|
Vector3 currentPosition = transform.position;
|
|
|
|
// Lock the Y position while allowing X and Z to update
|
|
transform.position = new Vector3(currentPosition.x, lockedY, currentPosition.z);
|
|
}
|
|
}
|