Hi, I’d like to make a camera which can move between 5 different empty game objects, each one with different position and rotation, by pressing the left and right arrow keys. I tried using Vector3.Lerp for the camera movement but the code didn’t work as expected. For example, instead of changing from position 1 to 2, or 3 to 4 and backwards, it changed positions randomly.
You need to store your game objects in a array then loop through your array should look similar to this
public Transform[] sample;
public Transform vurrentTarget;
if(input.GetButton.KeyCode(a))
{
if(currentTarget < sample.length){
crrentTarget = sample[currenttarget]++
}else{
currentTarget = 0;
}
lerp between current postion and new vector 3
}