void OnTriggerEnter(Collider other) { // When walking through a door if (other.gameObject.CompareTag("Door")) { DoorControl doorMono = other.gameObject.GetComponent <DoorControl>(); Vector3 goalPos = doorMono.goalDoor.transform.position + doorMono.goalDoor.transform.forward * DOOR_JUMP; goalPos.y = 0; doorMono.goalDoor.GetComponent <DoorControl>().EnterRoom(); // Move the character to the room linked to the door they went through this.transform.position = goalPos; // Make the camera follow the characters position mainCameraTransform.position = (doorMono.goalDoor.GetComponent <DoorControl>().ownRoom.transform.position) + cameraPosition; // Updates the room references to the new room doorMono.ExitRoom(); currentRoom = doorMono.goalDoor.GetComponent <DoorControl>().ownRoom; AchievementManager.Instance.enterRoom(currentRoom); } // Tracks webs the player is currently stepping on else if (other.gameObject.CompareTag("Web")) { inWeb++; } }