// This method will start sun wind. Or if there is one coming, this will reset it so it will start again. public static void Start() { IsActive = true; //m_burningCue = MyAudio.AddCue3D(MySoundCuesEnum.SfxSolarWind, m_initialSunWindPosition, m_directionFromSunNormalized, Vector3.Up, Vector3.Zero); const int meteorsCount = 5; //const int frontDistance = 1000; //const int sideDistance = 3000; const int minSpeed = 1000; const int maxSpeed = 4000; //Vector3 sphereCenter = MyCamera.Position + MyCamera.ForwardVector * frontDistance - MyCamera.LeftVector * sideDistance; Vector3 sphereCenter = MyCamera.Position + MyGuiScreenGamePlay.Static.GetDirectionToSunNormalized() * 10000; //Vector3 windForwardDirection = MyCamera.LeftVector ; int i = 0; while (i < meteorsCount) { //float distance = MyMwcUtils.GetRandomFloat(0, sphereRadius); //Vector3 position = sphereCenter + MyMwcUtils.GetRandomVector3Normalized() * new Vector3(distance, distance, distance); //Vector3 meteorDirection = (windForwardDirection + (MyMwcUtils.GetRandomVector3Normalized() * 0.05f)) * MyMwcUtils.GetRandomInt(minSpeed, maxSpeed); //Vector3 meteorDirection = -MyGuiScreenGamePlay.Static.GetDirectionToSunNormalized();// MyMwcUtils.GetRandomVector3HemisphereNormalized(-MyGuiScreenGamePlay.Static.GetDirectionToSunNormalized()); Vector3 meteorDirection = MyMwcUtils.GetRandomVector3HemisphereNormalized(-MyGuiScreenGamePlay.Static.GetDirectionToSunNormalized()); Vector3 position = sphereCenter + meteorDirection * MyMwcUtils.GetRandomInt(100, 5000); //float normalizedDistance = distance / sphereRadius; float size = MyMwcUtils.GetRandomInt(minSize, maxSize); MyLine line = new MyLine(position, position + meteorDirection * 100); MyIntersectionResultLineBoundingSphere?result = MyEntities.GetIntersectionWithLineAndBoundingSphere(ref line, null, null, 1, null, true); if (result != null) { //Do not create meteors colliding with base if (!(result.Value.PhysObject is MyMeteor)) { continue; } } Matrix worldMatrix = Matrix.CreateFromAxisAngle(MyMwcUtils.GetRandomVector3Normalized(), MyMwcUtils.GetRandomFloat(0, MathHelper.Pi)); worldMatrix.Translation = position; MyMeteor meteor = MyMeteor.GenerateMeteor(size, worldMatrix, position, m_fireMeteorMaterials[MyMwcUtils.GetRandomInt(0, m_fireMeteorMaterials.Count)]); float speed = MyMwcUtils.GetRandomInt(minSpeed, maxSpeed); meteor.Start(meteorDirection * speed, MyMwcUtils.GetRandomFloat(0, 1) > 0.92f ? 101 : 100); i++; } }