public void ViewChanged(DoubleVector lookDirection) { if (_marker2D != null) { _viewport.Children.Remove(_marker2D); } if (_marker2D == null) { _marker2D = new ScreenSpaceLines3D(); _marker2D.Color = UtilityWPF.ColorFromHex("60A0A0A0"); _marker2D.Thickness = 4d; } _marker2D.Clear(); RotateTransform3D transform = new RotateTransform3D(new QuaternionRotation3D(Math3D.GetRotation(new DoubleVector(0, 0, 1, 0, -1, 0), lookDirection))); #region Marker 2D double orthDist = (_sizeMult * _field.Size * 1.1d) / 2d; double cornerDist = (_sizeMult * _field.Size * .2d) / 2d; // TopLeft Point3D corner = transform.Transform(new Point3D(-orthDist, -orthDist, -orthDist)); Vector3D direction = transform.Transform(new Vector3D(cornerDist, 0, 0)); _marker2D.AddLine(corner, corner + direction); direction = transform.Transform(new Vector3D(0, cornerDist, 0)); _marker2D.AddLine(corner, corner + direction); //TopRight corner = transform.Transform(new Point3D(orthDist, -orthDist, -orthDist)); direction = transform.Transform(new Vector3D(-cornerDist, 0, 0)); _marker2D.AddLine(corner, corner + direction); direction = transform.Transform(new Vector3D(0, cornerDist, 0)); _marker2D.AddLine(corner, corner + direction); //BottomRight corner = transform.Transform(new Point3D(orthDist, orthDist, -orthDist)); direction = transform.Transform(new Vector3D(-cornerDist, 0, 0)); _marker2D.AddLine(corner, corner + direction); direction = transform.Transform(new Vector3D(0, -cornerDist, 0)); _marker2D.AddLine(corner, corner + direction); //BottomLeft corner = transform.Transform(new Point3D(-orthDist, orthDist, -orthDist)); direction = transform.Transform(new Vector3D(cornerDist, 0, 0)); _marker2D.AddLine(corner, corner + direction); direction = transform.Transform(new Vector3D(0, -cornerDist, 0)); _marker2D.AddLine(corner, corner + direction); _viewport.Children.Add(_marker2D); #endregion // Camera _camera.Position = transform.Transform(new Point3D(0, 0, (_sizeMult * _field.Size * -4d) / 2d)); _camera.LookDirection = lookDirection.Standard; _camera.UpDirection = lookDirection.Orth; // Remember it _lookDirection = lookDirection; }