I want to have a threshold where the camera wont move until the object being tracked goes beyond a certain value. My pseudo code looks like this:
var thresholdX = 5;
var thresholdY = 5;
function Update(){
if(target.position.x > thresholdX){
//do the lerp transition
transform.position.x = Mathf.Lerp(transform.position.x, target.transform.position.x + 20, Time.deltaTime);
}
The problem is it’s only applying the transition in one frame. Is there any other way I could achieve this? Something like path based camera.