Exemplo n.º 1
0
        private void MoveCameraToSelectedItem()
        {
            LevelGameObject selectedGO = objectList.SelectedItem as LevelGameObject;

            if (selectedGO == null)
            {
                MessageBox.Show(this, "Please select a game object from the list first.", "Snap game object");
                return;
            }

            GroundableEntity entityRep           = currentLevel.GetGameObjectRepresentation(selectedGO);
            Vector3          entityForwardOrient = Vector3.FORWARD * entityRep.Transform.Rotation;

            AssetLocator.MainCamera.Position = entityRep.Transform.Translation - entityForwardOrient.WithLength(PhysicsManager.ONE_METRE_SCALED * 0.2f);
            AssetLocator.MainCamera.Orient(entityForwardOrient, Vector3.UP);
        }