Hello, again. I’ve been trying to get a camera to jump to certain positions when the player hits the arrows keys. Basically if the player were to continuously hit the right arrow it would cycle through all the different camera positions. For some reason though when the player hits the right arrow nothing happens. I’m assuming that the code is being executed, but it is all happening at once so it cycles through all the positions and ends up back at the front position. Not really sure how to get it to stop on each position and wait for player input. My Code below.
var CameraFpos = true;
var CameraBpos = false;
var CameraRpos = false;
var CameraLpos = false;
function FixedUpdate() {
//Camera Right Spin from CameraFpos
if (CameraFpos && Input.GetButton("Right"))
{
Camera.main.transform.position.x = 65.757;
Camera.main.transform.position.z = 22.58412;
Camera.main.transform.rotation = Quaternion.Euler(0,270,0);
CameraFpos = false;
CameraRpos = true;
}
//Camera Right Spin from CameraRpos
if (CameraRpos && Input.GetButton("Right"))
{
Camera.main.transform.position.x = 18.0817;
Camera.main.transform.position.z = 69.14645;
Camera.main.transform.rotation = Quaternion.Euler(0,180,0);
CameraRpos = false;
CameraBpos = true;
}
//Camera Right Spin from CameraBpos
if (CameraBpos && Input.GetButton("Right"))
{
Camera.main.transform.position.x = -32.8335;
Camera.main.transform.position.z = 22.04136;
Camera.main.transform.rotation = Quaternion.Euler(0,90,0);
CameraBpos = false;
CameraLpos = true;
}
//Camera Right Spin from CameraLpos
if (CameraLpos && Input.GetButton("Right"))
{
Camera.main.transform.position.x = 18.9608;
Camera.main.transform.position.z = -25.7975;
Camera.main.transform.rotation = Quaternion.Euler(0,0,0);
CameraLpos = false;
CameraFpos = true;
}
}