// // Called every frame. 'delta' is the elapsed time since the previous frame. // public override void _Process(float delta) // { // // } /// <summary> /// Sets the viewport's camera to the perspective specified by the button press id /// passed by the button connection signal. /// </summary> /// <param name = "id">The PerspectiveTypeEmun value for the camera perspective associated with the toolbar button</param> /// private void toolbarChangePerspective(int id) { currentPerspective = (PerspectiveType)id; Node tmp = this.GetNode("../Viewport/Camera/CameraObj"); GD.Print(tmp.Name); GD.Print(tmp.GetType()); Godot.Camera tmp2 = (Godot.Camera)tmp; Godot.Camera subCam = (Godot.Camera)GetNode("../Viewport/Camera/CameraObj"); Script gdClass = ResourceLoader.Load("res://src/CameraObj.gd") as Script; Object gdCam = new Object(); gdCam = (Godot.Object)gdClass.Call("new"); gdCam.SetScript(gdClass); switch (currentPerspective) { case PerspectiveType.Front: //GD.Print(subCam.GetClass() + subCam.GetFilename()); Vector3 newLook = new Vector3(5, 1, 0); subCam.LookAtFromPosition(newLook, new Vector3(0, 0, 0), new Vector3(0, 1, 0)); gdCam.Call("_update_mouselook"); gdCam.Call("_update_movement"); break; case PerspectiveType.Back: //subCam = GetNode<Camera>("../Viewport/Camera/CameraObj"); newLook = new Vector3(-5, 1, 0); subCam.LookAtFromPosition(newLook, new Vector3(0, 0, 0), new Vector3(0, 1, 0)); gdCam.Call("_update_mouselook"); gdCam.Call("_update_movement"); break; case PerspectiveType.Orthogonal: //subCam = GetNode<Camera>("../Viewport/Camera/CameraObj"); subCam.SetOrthogonal(3, 1, 10); gdCam.Call("_update_mouselook"); gdCam.Call("_update_movement"); break; case PerspectiveType.NOrthogonal: subCam.Projection = 0; gdCam.Call("_update_mouselook"); gdCam.Call("_update_movement"); break; default: GD.Print("Unrecognized Menu Item"); break; } }