private void SetUpGameWorld() { SystemCore.PhysicsSimulation.ForceUpdater.Gravity = new BEPUutilities.Vector3(0, -9.81f, 0); Heightmap heightMap = NoiseGenerator.CreateHeightMap(NoiseGenerator.RidgedMultiFractal(0.03f), 100, 5, 20, 1, 1, 1); var terrainObject = heightMap.CreateTranslatedRenderableHeightMap(Color.OrangeRed, EffectLoader.LoadSM5Effect("flatshaded"), new Vector3(-250, 0, -250)); SystemCore.GameObjectManager.AddAndInitialiseGameObject(terrainObject); mouseCamera.SetPositionAndLook(new Vector3(0,50,0), (float)Math.PI, (float)-Math.PI / 5); duneBuggyOne = new DuneBuggy(PlayerIndex.One, Color.Red, new Vector3(0, 20, 0)); duneBuggyOne.Activate(); }
private void SwitchVehicle() { if (currentVehicle == "buggy") { Vector3 upVector = duneBuggyOne.BuggyObject.Transform.AbsoluteTransform.Translation - earth.Transform.AbsoluteTransform.Translation; upVector.Normalize(); currentVehicle = "ship"; spaceShipOne.Activate(); spaceShipOne.Teleport(duneBuggyOne.BuggyObject.Transform.AbsoluteTransform.Translation + (upVector * 50)); spaceShipCamera.Activate(); duneBuggyOne.Deactivate(); } else { currentVehicle = "buggy"; spaceShipOne.Deactivate(); duneBuggyOne.Teleport(spaceShipOne.ShipObject.Transform.AbsoluteTransform.Translation); duneBuggyOne.Activate(); duneBuggyCamera.Activate(); } }