Hey, my cemera is following the player and its all good and dandy.
But I want for it to be able to detect a door for example, and untill it opens, when the player gets close, he can’t see anything after it.
So I’ve written the detetction part, but I’m looking for a way to lock the cemera in place and unlock it when you get close and get far from the door, is ther a way to do so?
`
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraBoundry : MonoBehaviour
{
private bool IsBounded;
public Transform _cameraPosition;
public float checkRadius;
public LayerMask whatIsBoundry;
GameObject mainCamera;
void Start()
{
mainCamera = (GameObject)GameObject.FindWithTag("MainCamera");
}
void FixedUpdate()
{
IsBounded = Physics2D.OverlapCircle(_cameraPosition.position, checkRadius, whatIsBoundry);
if (IsBounded == true)
{
mainCamera.transform.position = new Vector3();
}
}
}