public void applyTexture() { switch (selectMode) { case 4: materialManager.AddMaterial(objectToMove, "Wood"); break; case 5: materialManager.AddMaterial(objectToMove, "Metal"); break; default: Debug.Log("No texture selected"); break; } }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { #region Init World _boundryMin = new Point3D(-BOUNDRYSIZEHALF, -BOUNDRYSIZEHALF, -BOUNDRYSIZEHALF); _boundryMax = new Point3D(BOUNDRYSIZEHALF, BOUNDRYSIZEHALF, BOUNDRYSIZEHALF); _world = new World(); _world.Updating += new EventHandler <WorldUpdatingArgs>(World_Updating); _world.SetCollisionBoundry(_boundryMin, _boundryMax); //TODO: Only draw the boundry lines if options say to #endregion #region Materials _materialManager = new MaterialManager(_world); // Bot var material = new Game.Newt.v2.NewtonDynamics.Material(); _material_Bot = _materialManager.AddMaterial(material); // Collisions //_materialManager.RegisterCollisionEvent(_material_Bot, _material_Bot, Collision_BotBot); //_materialManager.RegisterCollisionEvent(_material_Bot, _material_Asteroid, Collision_BotAsteroid); #endregion #region Map _map = new Map(_viewport, null, _world); _map.SnapshotFequency_Milliseconds = 250; _map.SnapshotMaxItemsPerNode = 10; _map.ShouldBuildSnapshots = false; _map.ShouldShowSnapshotLines = false; _map.ShouldSnapshotCentersDrift = true; //_map.ItemAdded += Map_ItemAdded; //_map.ItemRemoved += Map_ItemRemoved; #endregion #region Update Manager _updateManager = new UpdateManager( new Type[] { typeof(ControlledThrustBot) }, new Type[] { typeof(ControlledThrustBot) }, _map); #endregion _world.UnPause(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), this.Title, MessageBoxButton.OK, MessageBoxImage.Error); } }
private void SaveMaterial() { ErrorProvider.Clear(); var isFormValid = true; if (Math.Abs(dblInPrice.Value) <= 0) { isFormValid = false; ErrorProvider.SetError(dblInPrice, Resources.ThisFieldIsRequired); dblInPrice.Focus(); } if (txtName.Text.FullTrim().IsNullOrEmptyOrWhiteSpace()) { isFormValid = false; ErrorProvider.SetError(txtName, Resources.ThisFieldIsRequired); txtName.Focus(); } if (txtCode.Text.FullTrim().IsNullOrEmptyOrWhiteSpace()) { isFormValid = false; ErrorProvider.SetError(txtCode, Resources.ThisFieldIsRequired); txtCode.Focus(); } if (!isFormValid) { return; } var isMaterialCodeExists = !IsEditMode ? MaterialManager.IsMaterialCodeExists(txtCode.Text.FullTrim()) : txtCode.Text.FullTrim() != Material.Code && MaterialManager.IsMaterialCodeExists(txtCode.Text.FullTrim()); var isMaterialNameExists = !IsEditMode ? MaterialManager.IsMaterialNameExists(txtName.Text.FullTrim()) : txtName.Text.FullTrim() != Material.Name && MaterialManager.IsMaterialNameExists(txtName.Text.FullTrim()); if (isMaterialNameExists && isMaterialCodeExists) { isFormValid = ShowConfirmationDialog(Resources.MaterialCodeAndNameAlreadyUsed) == DialogResult.Yes; } else if (isMaterialNameExists) { isFormValid = ShowConfirmationDialog(Resources.MaterialNameAlreadyUsed) == DialogResult.Yes; } else if (isMaterialCodeExists) { isFormValid = ShowConfirmationDialog(Resources.MaterialCodeAlreadyUsed) == DialogResult.Yes; } if (!isFormValid) { return; } if (!IsEditMode) { MaterialManager.AddMaterial(new Material { Code = txtCode.Text.FullTrim(), Name = txtName.Text.FullTrim(), Price = (decimal)dblInPrice.Value, Quantity = (decimal)dblInQuantity.Value, IsArchived = false }); } else { Material.Code = txtCode.Text.FullTrim(); Material.Name = txtName.Text.FullTrim(); Material.Price = (decimal)dblInPrice.Value; Material.Quantity = (decimal)dblInQuantity.Value; MaterialManager.UpdateMaterial(Material); } ShowInfoMsg(IsEditMode ? Resources.MaterialEditedSuccessfully : Resources.MaterialAddedSuccessfully); Close(); }
/// <summary> /// Once the world is created on the worker thread, maps and bots need to be created for each room /// NOTE: This is called from the worker thread /// </summary> private void Arena_WorldCreated(object sender, EventArgs e) { World world = Arena.WorldAccessor.World; #region materials MaterialManager = new MaterialManager(world); MaterialIDs = new MaterialIDs(); // Wall Game.Newt.v2.NewtonDynamics.Material material = new Game.Newt.v2.NewtonDynamics.Material(); material.Elasticity = ItemOptionsArco.ELASTICITY_WALL; MaterialIDs.Wall = MaterialManager.AddMaterial(material); // Bot material = new Game.Newt.v2.NewtonDynamics.Material(); MaterialIDs.Bot = MaterialManager.AddMaterial(material); // Bot Ram material = new Game.Newt.v2.NewtonDynamics.Material(); material.Elasticity = ItemOptionsArco.ELASTICITY_BOTRAM; MaterialIDs.BotRam = MaterialManager.AddMaterial(material); // Exploding Bot material = new Game.Newt.v2.NewtonDynamics.Material(); material.IsCollidable = false; MaterialIDs.ExplodingBot = MaterialManager.AddMaterial(material); // Weapon material = new Game.Newt.v2.NewtonDynamics.Material(); MaterialIDs.Weapon = MaterialManager.AddMaterial(material); // Treasure Box material = new Game.Newt.v2.NewtonDynamics.Material(); MaterialIDs.TreasureBox = MaterialManager.AddMaterial(material); //TODO: Uncomment these // Collisions //_materialManager.RegisterCollisionEvent(_materialIDs.Bot, _materialIDs.Bot, Collision_BotBot); //_materialManager.RegisterCollisionEvent(_materialIDs.Bot, _materialIDs.Weapon, Collision_BotWeapon); //_materialManager.RegisterCollisionEvent(_materialIDs.Weapon, _materialIDs.Weapon, Collision_WeaponWeapon); ////_materialManager.RegisterCollisionEvent(_materialIDs.Bot, _materialIDs.Wall, Collision_BotWall); //_materialManager.RegisterCollisionEvent(_materialIDs.Weapon, _materialIDs.Wall, Collision_WeaponWall); //_materialManager.RegisterCollisionEvent(_materialIDs.Weapon, _materialIDs.TreasureBox, Collision_WeaponTreasureBox); //_materialManager.RegisterCollisionEvent(_materialIDs.Bot, _materialIDs.TreasureBox, Collision_BotTreasureBox); #endregion List <KeepItems2D> keep2Ds = new List <KeepItems2D>(); foreach (var(room, _) in Arena.AllRooms) { #region keep 2D //TODO: drag plane should either be a plane or a large cylinder, based on the current (level|scene|stage|area|arena|map|place|region|zone) // This game is 3D emulating 2D, so always have the mouse go to the XY plane DragHitShape dragPlane = new DragHitShape(); dragPlane.SetShape_Plane(new Triangle(new Point3D(-1, -1, room.Center.Z), new Point3D(1, -1, room.Center.Z), new Point3D(0, 1, room.Center.Z))); // This will keep objects onto that plane using forces (not velocities) KeepItems2D keep2D = new KeepItems2D { SnapShape = dragPlane, }; //keep2D.Add(room.Bot, false); keep2Ds.Add(keep2D); #endregion #region bot ShipCoreArgs core = new ShipCoreArgs() { World = world, Material_Ship = MaterialIDs.Bot, Map = room.Map, }; //BotConstructor_Events events = new BotConstructor_Events(); //events. // Create the bot Bot bot = null; if (RequestCustomBot != null) { bot = RequestCustomBot(core, keep2D, dragPlane, MaterialIDs); } else { BotConstruction_Result construction = BotConstructor.ConstructBot(DNA, core, ShipExtraArgs); bot = new Bot(construction); } // Find some parts BrainNEAT brainPart = bot.Parts.FirstOrDefault(o => o is BrainNEAT) as BrainNEAT; if (brainPart == null) { throw new ApplicationException("Didn't find BrainNEAT part"); } SensorHoming[] homingParts = bot.Parts. Where(o => o is SensorHoming). Select(o => (SensorHoming)o). ToArray(); if (homingParts.Length == 0) { throw new ApplicationException("Didn't find SensorHoming part"); } #endregion room.Bot = bot; room.BrainPart = brainPart; room.HomingParts = homingParts; foreach (SensorHoming homing in homingParts) { homing.HomePoint = room.Center; homing.HomeRadius = (ROOMSIZE / 2d) * Evaluator3.MULT_HOMINGSIZE; } room.Map.AddItem(bot); keep2D.Add(room.Bot, false); } Keep2D = keep2Ds.ToArray(); world.Updated += World_Updated; }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { //_backgroundTiles = new BackgoundTiles(_sceneCanvas, _camera, (Brush)this.FindResource("color_SceneBackAlt")); #region Init World _boundryMin = new Point3D(-BOUNDRYSIZEHALF, -BOUNDRYSIZEHALF, -BOUNDRYSIZEHALF); _boundryMax = new Point3D(BOUNDRYSIZEHALF, BOUNDRYSIZEHALF, BOUNDRYSIZEHALF); _world = new World(); _world.Updating += new EventHandler <WorldUpdatingArgs>(World_Updating); _world.SetCollisionBoundry(_boundryMin, _boundryMax); //TODO: Only draw the boundry lines if options say to #endregion #region Materials _materialManager = new MaterialManager(_world); // Bot var material = new Game.Newt.v2.NewtonDynamics.Material(); _material_Bot = _materialManager.AddMaterial(material); // Asteroid material = new Game.Newt.v2.NewtonDynamics.Material(); material.Elasticity = .1d; _material_Asteroid = _materialManager.AddMaterial(material); // Collisions _materialManager.RegisterCollisionEvent(_material_Bot, _material_Bot, Collision_BotBot); _materialManager.RegisterCollisionEvent(_material_Bot, _material_Asteroid, Collision_BotAsteroid); #endregion #region Trackball // Camera Trackball _trackball = new TrackBallRoam(_camera); _trackball.EventSource = grdViewPort; //NOTE: If this control doesn't have a background color set, the trackball won't see events (I think transparent is ok, just not null) _trackball.AllowZoomOnMouseWheel = true; _trackball.ShouldHitTestOnOrbit = true; _trackball.Mappings.AddRange(TrackBallMapping.GetPrebuilt(TrackBallMapping.PrebuiltMapping.MouseComplete_NoLeft)); //_trackball.GetOrbitRadius += new GetOrbitRadiusHandler(Trackball_GetOrbitRadius); #endregion #region Map _map = new Map(_viewport, null, _world); _map.SnapshotFequency_Milliseconds = 250;// 125; _map.SnapshotMaxItemsPerNode = 10; _map.ShouldBuildSnapshots = true; _map.ShouldShowSnapshotLines = false; _map.ShouldSnapshotCentersDrift = true; _map.ItemAdded += Map_ItemAdded; _map.ItemRemoved += Map_ItemRemoved; #endregion #region Update Manager _updateManager = new UpdateManager( new Type[] { typeof(SwarmBot1a) }, new Type[] { typeof(SwarmBot1a) }, _map); #endregion #region Strokes _strokes = new SwarmObjectiveStrokes(_world.WorldClock, SUBSTROKESIZE, 15); _strokes.PointsChanged += Strokes_PointsChanged; #endregion #region Bot Clusters _botClusters = new SwarmClusters(_map); _botClusterTimer = new System.Timers.Timer(); _botClusterTimer.Interval = 1111; _botClusterTimer.AutoReset = false; // makes sure only one tick is firing at a time _botClusterTimer.Elapsed += BotClusterTimer_Elapsed; _botClusterTimer.Start(); #endregion _world.UnPause(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), this.Title, MessageBoxButton.OK, MessageBoxImage.Error); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { _itemOptions = new ItemOptions(); #region Init World _boundryMin = new Point3D(-BOUNDRYSIZEHALF, -BOUNDRYSIZEHALF, -BOUNDRYSIZEHALF); _boundryMax = new Point3D(BOUNDRYSIZEHALF, BOUNDRYSIZEHALF, BOUNDRYSIZEHALF); _world = new World(); _world.Updating += new EventHandler <WorldUpdatingArgs>(World_Updating); _world.SetCollisionBoundry(_boundryMin, _boundryMax); //TODO: Only draw the boundry lines if options say to #endregion #region Materials _materialManager = new MaterialManager(_world); // Wall Game.Newt.v2.NewtonDynamics.Material material = new Game.Newt.v2.NewtonDynamics.Material(); material.Elasticity = .1d; _material_Wall = _materialManager.AddMaterial(material); // Bot material = new Game.Newt.v2.NewtonDynamics.Material(); _material_Bot = _materialManager.AddMaterial(material); // Exploding Bot material = new Game.Newt.v2.NewtonDynamics.Material(); material.IsCollidable = false; _material_ExplodingBot = _materialManager.AddMaterial(material); // Food material = new Game.Newt.v2.NewtonDynamics.Material(); material.Elasticity = .1d; _material_Food = _materialManager.AddMaterial(material); // Egg material = new Game.Newt.v2.NewtonDynamics.Material(); material.Elasticity = .5d; _material_Egg = _materialManager.AddMaterial(material); // Projectile material = new Game.Newt.v2.NewtonDynamics.Material(); _material_Projectile = _materialManager.AddMaterial(material); // Collisions _materialManager.RegisterCollisionEvent(_material_Bot, _material_Bot, Collision_BotBot); _materialManager.RegisterCollisionEvent(_material_Bot, _material_Food, Collision_BotFood); //TODO: May want to listen to projectile collisions #endregion #region Trackball // Trackball _trackball = new TrackBallRoam(_camera); _trackball.KeyPanScale = 15d; _trackball.EventSource = grdViewPort; //NOTE: If this control doesn't have a background color set, the trackball won't see events (I think transparent is ok, just not null) _trackball.AllowZoomOnMouseWheel = true; _trackball.Mappings.AddRange(TrackBallMapping.GetPrebuilt(TrackBallMapping.PrebuiltMapping.MouseComplete_NoLeft)); _trackball.Mappings.AddRange(TrackBallMapping.GetPrebuilt(TrackBallMapping.PrebuiltMapping.Keyboard_ASDW_In)); _trackball.ShouldHitTestOnOrbit = true; //_trackball.UserMovedCamera += new EventHandler<UserMovedCameraArgs>(Trackball_UserMovedCamera); //_trackball.GetOrbitRadius += new EventHandler<GetOrbitRadiusArgs>(Trackball_GetOrbitRadius); #endregion #region Camera Pool //TODO: Make the number of threads more configurable, look at how many processors there are //_cameraPool = new CameraPool(2, Colors.Black); _cameraPool = new CameraPool(1, Colors.Black); #endregion #region Map _map = new Map(_viewport, _cameraPool, _world) { SnapshotFequency_Milliseconds = 250, // 125 SnapshotMaxItemsPerNode = 10, ShouldBuildSnapshots = true, ShouldShowSnapshotLines = false, ShouldSnapshotCentersDrift = true, }; _updateManager = new UpdateManager( new Type[] { typeof(Swimbot) }, new Type[] { typeof(Swimbot) }, _map); #endregion #region Fields _radiation = new RadiationField() { AmbientRadiation = 0d, }; //_gravity = new GravityFieldUniform() //{ // Gravity = new Vector3D(0, 0, 0), //}; //TODO: Support a uniform fluid //FluidField #endregion #region ItemSelectDragLogic _selectionLogic = new ItemSelectDragLogic(_map, _camera, _viewport, grdViewPort) { ShouldMoveItemWithSpring = true, ShouldSpringCauseTorque = false, SpringColor = null, // Colors.Chartreuse ShowDebugVisuals = false, // true }; _selectionLogic.SelectableTypes.Add(typeof(Bot)); _selectionLogic.SelectableTypes.Add(typeof(Mineral)); _selectionLogic.SelectableTypes.Add(typeof(Egg <ShipDNA>)); _selectionLogic.ItemSelected += new EventHandler <ItemSelectedArgs>(SelectionLogic_ItemSelected); #endregion _world.UnPause(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), this.Title, MessageBoxButton.OK, MessageBoxImage.Error); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { _itemOptions = new ItemOptions(); #region Init World _boundryMin = new Point3D(-BOUNDRYSIZEHALF, -BOUNDRYSIZEHALF, -BOUNDRYSIZEHALF); _boundryMax = new Point3D(BOUNDRYSIZEHALF, BOUNDRYSIZEHALF, BOUNDRYSIZEHALF); _world = new World(); _world.Updating += new EventHandler <WorldUpdatingArgs>(World_Updating); _world.SetCollisionBoundry(_boundryMin, _boundryMax); #endregion #region Materials _materialManager = new MaterialManager(_world); // Wall Game.Newt.v2.NewtonDynamics.Material material = new Game.Newt.v2.NewtonDynamics.Material(); material.Elasticity = .1d; _material_Wall = _materialManager.AddMaterial(material); // Ball material = new Game.Newt.v2.NewtonDynamics.Material(); _material_Ball = _materialManager.AddMaterial(material); #endregion #region Trackball // Trackball _trackball = new TrackBallRoam(_camera); _trackball.KeyPanScale = 15d; _trackball.EventSource = grdViewPort; //NOTE: If this control doesn't have a background color set, the trackball won't see events (I think transparent is ok, just not null) _trackball.AllowZoomOnMouseWheel = true; _trackball.Mappings.AddRange(TrackBallMapping.GetPrebuilt(TrackBallMapping.PrebuiltMapping.MouseComplete_NoLeft)); _trackball.Mappings.AddRange(TrackBallMapping.GetPrebuilt(TrackBallMapping.PrebuiltMapping.Keyboard_ASDW_In)); _trackball.ShouldHitTestOnOrbit = true; //_trackball.UserMovedCamera += new EventHandler<UserMovedCameraArgs>(Trackball_UserMovedCamera); //_trackball.GetOrbitRadius += new EventHandler<GetOrbitRadiusArgs>(Trackball_GetOrbitRadius); #endregion #region Chased Ball _chasedBall = new ChasedBall(); _chasedBall.MotionType_Position = MotionType_Position.Stop; _chasedBall.MotionType_Orientation = MotionType_Orientation.Stop; _chasedBall.BoundrySizeChanged += new EventHandler(ChasedBall_BoundrySizeChanged); // Ball visual _chasedBallVisual = GetChaseBallVisual_Position(); _chasedBallTransform = new TranslateTransform3D(); _chasedBallVisual.Transform = _chasedBallTransform; _viewport.Children.Add(_chasedBallVisual); // Direction Visual var directionVisual = GetChaseBallVisual_Orientation(); _chasedDirectionModel = directionVisual.Item1; _chasedDirectionVisual = directionVisual.Item2; _viewport.Children.Add(_chasedDirectionVisual); // Panels (the act of instantiating them will update the ball's properties) pnlChasePosition.Content = new ChasedPosition(_chasedBall) { Foreground = Brushes.White, }; pnlChaseOrientation.Content = new ChasedOrientation(_chasedBall) { Foreground = Brushes.White, }; #endregion #region Debug Visuals // Put these on the viewport before the ball so that it is propertly semitransparent //TODO: Draw the bounding box. Use XYZ colors. This will help the user stay oriented #endregion #region Body Ball _bodyBall = new BodyBall(_world); //_bodyBall.PhysicsBody.AngularDamping = new Vector3D(.0001, .0001, .0001); //_bodyBall.PhysicsBody.AngularVelocity = new Vector3D(0, 0, 4 * Math.PI); _viewport.Children.AddRange(_bodyBall.Visuals3D); #endregion RedrawBoundry(); _world.UnPause(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), this.Title, MessageBoxButton.OK, MessageBoxImage.Error); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { //_camera.Position = new Point3D(0, 0, -1000); //_camera.LookDirection = new Vector3D(0, 0, 1); //_camera.UpDirection = new Vector3D(0, 1, 0); #region Init World // Set the size of the world to something a bit random (gets boring when it's always the same size) double halfSize = 325 + StaticRandom.Next(500); halfSize *= 1d + (StaticRandom.NextDouble() * 5d); _boundryMin = new Point3D(-halfSize, -halfSize, halfSize * -.25); _boundryMax = new Point3D(halfSize, halfSize, halfSize * .25); _world = new World(); _world.Updating += new EventHandler <WorldUpdatingArgs>(World_Updating); var boundryLines = _world.SetCollisionBoundry(_boundryMin, _boundryMax); // Draw the lines _boundryLines = new ScreenSpaceLines3D(true); _boundryLines.Thickness = 1d; _boundryLines.Color = WorldColors.BoundryLines; _viewport.Children.Add(_boundryLines); foreach (var line in boundryLines.innerLines) { _boundryLines.AddLine(line.from, line.to); } #endregion #region Materials _materialManager = new MaterialManager(_world); // Asteroid Game.Newt.v2.NewtonDynamics.Material material = new Game.Newt.v2.NewtonDynamics.Material(); material.Elasticity = .25d; material.StaticFriction = .9d; material.KineticFriction = .75d; _material_Asteroid = _materialManager.AddMaterial(material); // Mineral material = new Game.Newt.v2.NewtonDynamics.Material(); material.Elasticity = .5d; material.StaticFriction = .9d; material.KineticFriction = .4d; _material_Mineral = _materialManager.AddMaterial(material); // Space Station (force field) material = new Game.Newt.v2.NewtonDynamics.Material(); material.Elasticity = .99d; material.StaticFriction = .02d; material.KineticFriction = .01d; _material_SpaceStation = _materialManager.AddMaterial(material); _materialManager.RegisterCollisionEvent(_material_SpaceStation, _material_Asteroid, Collision_SpaceStation); _materialManager.RegisterCollisionEvent(_material_SpaceStation, _material_Mineral, Collision_SpaceStation); #endregion #region Trackball // Trackball _trackball = new TrackBallRoam(_camera); _trackball.KeyPanScale = 15d; _trackball.EventSource = grdViewPort; //NOTE: If this control doesn't have a background color set, the trackball won't see events (I think transparent is ok, just not null) _trackball.AllowZoomOnMouseWheel = true; _trackball.Mappings.AddRange(TrackBallMapping.GetPrebuilt(TrackBallMapping.PrebuiltMapping.MouseComplete_NoLeft_RightRotateInPlace)); _trackball.Mappings.AddRange(TrackBallMapping.GetPrebuilt(TrackBallMapping.PrebuiltMapping.Keyboard_ASDW_In)); //_trackball.GetOrbitRadius += new GetOrbitRadiusHandler(Trackball_GetOrbitRadius); _trackball.ShouldHitTestOnOrbit = true; #endregion #region Map _map = new Map(_viewport, null, _world); _map.SnapshotFequency_Milliseconds = 125; _map.SnapshotMaxItemsPerNode = 10; _map.ShouldBuildSnapshots = true; _map.ShouldShowSnapshotLines = _optionsPanel.OctreeShowLines; _map.ShouldSnapshotCentersDrift = _optionsPanel.OctreeCentersDrift; #endregion #region UpdateManager _updateManager = new UpdateManager( new Type[] { typeof(SpaceStation) }, new Type[0], _map); #endregion CreateFields(); //TODO: Add these during a timer to minimize the load time if (_optionsPanel.ShowStars) { CreateStars(); } CreateAsteroids(); CreateMinerals(); CreateSpaceStations(); // creating these last so stuff shows up behind them #region Start Position #region Farthest Station //// The center is too chaotic, so choose the farthest out space station //Point3D farthestStationPoint = new Point3D(0, 0, 0); //double farthestStationDistance = 0d; //foreach (Point3D stationPosition in _map.GetAllObjects().Where(o => o is SpaceStation).Select(o => o.PositionWorld)) //{ // double distance = stationPosition.ToVector().LengthSquared; // if (distance > farthestStationDistance) // { // farthestStationPoint = stationPosition; // farthestStationDistance = distance; // } //} //// Set the camera near there //_camera.Position = farthestStationPoint + (farthestStationPoint.ToVector().ToUnit() * 75d) + Math3D.GetRandomVectorSphericalShell(25d); //_camera.LookDirection = _camera.Position.ToVector() * -1d; //_camera.UpDirection = new Vector3D(0, 0, 1); #endregion #region Random Station List <Point3D> stationPoints = _map.GetAllItems().Where(o => o is SpaceStation).Select(o => o.PositionWorld).ToList(); Point3D stationPoint = stationPoints[StaticRandom.Next(stationPoints.Count)]; // Set the camera near there _camera.Position = stationPoint + (stationPoint.ToVector().ToUnit() * 75d) + Math3D.GetRandomVector_Spherical_Shell(25d); _camera.LookDirection = _camera.Position.ToVector() * -1d; _camera.UpDirection = new Vector3D(0, 0, 1); #endregion #endregion //TODO: kuler for dialogs _world.UnPause(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), this.Title, MessageBoxButton.OK, MessageBoxImage.Error); } }