void EntityIDInput(ScreenResult result, string resultText)
        {
            if (result == ScreenResult.Ok)
            {
                uint entityID;
                if (uint.TryParse(resultText, out entityID))
                {
                    var entity = MyEntities.GetEntityByIdOrNull(new MyEntityIdentifier(entityID));
                    if (entity != null)
                    {
                        var position = entity.GetPosition() - entity.WorldVolume.Radius * entity.GetForward();
                        MySpectator.SetViewMatrix(Matrix.CreateLookAt(position, entity.GetPosition(), entity.GetUp()));

                        MyEditorGizmo.AddEntityToSelection(entity);
                    }
                    else
                    {
                        MyGuiScreenMessageBox.Show(MyTextsWrapperEnum.EntityIsNotExist, type: MyMessageBoxType.ERROR);
                    }
                }
                else
                {
                    MyGuiScreenMessageBox.Show(MyTextsWrapperEnum.WrongNumberFormat, type: MyMessageBoxType.ERROR);
                }
            }
        }
 /// <summary>
 /// OnResetCamera
 /// </summary>
 /// <param name="sender"></param>
 public void OnResetCamera(MyDebugConsole.MyDebugConsoleItem sender)
 {
     MySpectator.ResetSpectatorView();
 }
Example #3
0
        public Matrix GetSpectatorMatrix()
        {
            Matrix worldMatrix = Matrix.Invert(MySpectator.GetViewMatrix());

            return(worldMatrix);
        }