Explorar el Código

Center camera on selected object using the HOME key

julyfortoday hace 10 años
padre
commit
0981492802
Se han modificado 1 ficheros con 11 adiciones y 0 borrados
  1. 11 0
      bin/Data/Scripts/Editor/EditorView.as

+ 11 - 0
bin/Data/Scripts/Editor/EditorView.as

@@ -1245,6 +1245,17 @@ void UpdateView(float timeStep)
         }
     }
 
+	if (input.keyDown[KEY_HOME])
+	{
+		if(selectedNodes.length > 0 || selectedComponents.length > 0)
+		{
+			Quaternion q = Quaternion(activeViewport.cameraPitch, activeViewport.cameraYaw, 0);
+			Vector3 centerPoint = SelectedNodesCenterPoint();
+			Vector3 d = cameraNode.worldPosition - centerPoint;
+			cameraNode.worldPosition = centerPoint - q * Vector3(0.0, 0.0,10);
+		}
+	}
+	
     // Rotate/orbit/pan camera
     if (input.mouseButtonDown[MOUSEB_RIGHT] || input.mouseButtonDown[MOUSEB_MIDDLE])
     {