public void onUpdate() { if (inCameraMode) { if (!cameraActivated) { camera = new Camera(); camera.Activate(); currentPosition = Player.Character.Position; Player.CanControlCharacter = false; cameraActivated = true; } float z = World.GetGroundZ(currentPosition, GroundType.Highest); camera.Position = currentPosition + new Vector3(0, -300 * (getPercentageZoom() - 0.05f * 3.0f), zoom + z); camera.LookAt(new Vector3(currentPosition.X, currentPosition.Y, z)); } else { if (cameraActivated) { camera.Deactivate(); //Game.DefaultCamera.Activate(); Player.CanControlCharacter = true; cameraActivated = false; } } }
private void createCamera() { if (camera != null && camera.Exists()) { camera.Deactivate(); } camera = new Camera(); camera.Position = Game.CurrentCamera.Position; camera.Direction = Game.CurrentCamera.Direction; camera.Rotation = Game.CurrentCamera.Rotation; camera.Activate(); }