Exemplo n.º 1
0
        private void SnapSelectedToCamera()
        {
            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);

            entityRep.Transform = selectedGO.Transform = selectedGO.Transform.With(
                rotation: Quaternion.FromVectorTransition(Vector3.UP, AssetLocator.MainCamera.Orientation),
                translation: AssetLocator.MainCamera.Position
                );

            if (selectedGO.GroundingGeometryEntity != null)
            {
                currentLevel.ResetGameObject(selectedGO);
            }
            UpdateSelectedObject();
        }