void Update() { if (Input.GetMouseButton(1)) { //Destroys last frame's VRoom if (vRoomPreviewInstance != null) { Destroy(vRoomPreviewInstance.gameObject); } //Scrolling controls VRoom's teleportation distance if (Input.mouseScrollDelta != null) { scrolledDistance += Input.mouseScrollDelta.y * scrollDistanceRate; } telePoint = lineOfSightScript.GetVRoomTelepoint(scrolledDistance); if (!yAxis)//Don't move from current y-position { telePoint.y = vRoomAndPlayer.position.y; } //Preview location of VRoom vRoomPreviewInstance = Instantiate(vRoomPreview, telePoint, vRoomPreview.transform.rotation); } if (Input.GetMouseButtonUp(1)) { if (vRoomPreviewInstance != null) { Destroy(vRoomPreviewInstance.gameObject); } vRoomAndPlayer.transform.position = telePoint; //Teleport vRoomAndPlayer scrolledDistance = 0f; //Reset } }