public void deactivateHallCam() { curCamState = camState.def; camPos = transform.position + new Vector3(0f, 6f, -1.5f); mainCam.transform.rotation = defaultMainCamRotation; }
void Start() { camPos = transform.position + new Vector3 (0f, 6f, -1.5f); currentEdge = -1; defaultMainCamRotation = mainCam.transform.rotation; // lol i cheated oops hallMainCamRotation = new Quaternion (0.7372774f, 0f, 0f, 0.6755902f); curCamState = camState.def; }
public void changeState(camState s) { state = s; if (state == camState.transition) { startTransition(); } }
void Start() { camPos = transform.position + new Vector3(0f, 6f, -1.5f); currentEdge = -1; defaultMainCamRotation = mainCam.transform.rotation; // lol i cheated oops hallMainCamRotation = new Quaternion(0.7372774f, 0f, 0f, 0.6755902f); curCamState = camState.def; }
public void activateSneakCam(int direction, Vector3 camMoveDirection) { // Set it up once and be done this is really hacky if (curCamState != camState.sneak || currentEdge != direction) { // Set states currentEdge = direction; curCamState = camState.sneak; // Load up camPos with init location camPos = camMoveDirection; // Bring cam down camPos.y -= 2.5f; // Figure out where sneak cam is going to look at sneakCamLookAtPosition = player.transform.position; // At left edge if (direction == 0) { // Move to the front of character camPos += player.transform.forward * 3; // Move to direction of the hallway camPos += (-0.5f * player.transform.right); sneakCamLookAtPosition += (-1 * player.transform.right); } // At right edge if (direction == 1) { // Move to the front of character camPos += player.transform.forward * 3; // Move to direction of the hallway camPos += (0.5f * player.transform.right); sneakCamLookAtPosition += player.transform.right; } // At both (1 block wide wall) if (direction == 3) { print ("both"); camPos = (player.transform.forward * 3) + player.transform.position; } // Check if camPos will intersect a wall RaycastHit wallCheck; // Check if camPos will have a wall in between player and cam if (Physics.Raycast (player.transform.position, (camPos - player.transform.position), out wallCheck, Vector3.Magnitude(camPos - player.transform.position))) { // If it collides with a wall, move camera closer if (wallCheck.collider.tag == "Wall") { camPos.x = wallCheck.point.x; camPos.z = wallCheck.point.z; camPos.y += 2f; } } } }
public void deactivateHallCam() { curCamState = camState.def; camPos = transform.position + new Vector3 (0f, 6f, -1.5f); mainCam.transform.rotation = defaultMainCamRotation; }
public void activateHallCam() { curCamState = camState.hall; camPos = transform.position + new Vector3 (0f, 6.5f, -0.2f); mainCam.transform.rotation = Quaternion.Lerp(mainCam.transform.rotation, hallMainCamRotation, 0.1f); }
public void activateHallCam() { curCamState = camState.hall; camPos = transform.position + new Vector3(0f, 6.5f, -0.2f); mainCam.transform.rotation = Quaternion.Lerp(mainCam.transform.rotation, hallMainCamRotation, 0.1f); }
public void activateSneakCam(int direction, Vector3 camMoveDirection) { // Set it up once and be done this is really hacky if (curCamState != camState.sneak || currentEdge != direction) { // Set states currentEdge = direction; curCamState = camState.sneak; // Load up camPos with init location camPos = camMoveDirection; // Bring cam down camPos.y -= 2.5f; // Figure out where sneak cam is going to look at sneakCamLookAtPosition = player.transform.position; // At left edge if (direction == 0) { // Move to the front of character camPos += player.transform.forward * 3; // Move to direction of the hallway camPos += (-0.5f * player.transform.right); sneakCamLookAtPosition += (-1 * player.transform.right); } // At right edge if (direction == 1) { // Move to the front of character camPos += player.transform.forward * 3; // Move to direction of the hallway camPos += (0.5f * player.transform.right); sneakCamLookAtPosition += player.transform.right; } // At both (1 block wide wall) if (direction == 3) { print("both"); camPos = (player.transform.forward * 3) + player.transform.position; } // Check if camPos will intersect a wall RaycastHit wallCheck; // Check if camPos will have a wall in between player and cam if (Physics.Raycast(player.transform.position, (camPos - player.transform.position), out wallCheck, Vector3.Magnitude(camPos - player.transform.position))) { // If it collides with a wall, move camera closer if (wallCheck.collider.tag == "Wall") { camPos.x = wallCheck.point.x; camPos.z = wallCheck.point.z; camPos.y += 2f; } } } }