Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MyEntitySubpart subpart1 = cubeBlock.GetSubpart("MissileTurretBase1");
- MyEntitySubpart subpart2 = subpart1.GetSubpart("MissileTurretBarrels"); ;
- //MyAPIGateway.Utilities.ShowNotification("Dif: " + (currentShootTime - lastShootTime), 17, MyFontEnum.Blue);
- //Constants
- double maxDevianceAngle = 0.1;
- double maxRange = 800;
- double minRange = 6;
- double horizOffset = 1.5;
- //Generate random seed
- System.Random rand = new System.Random();
- //Generate random offsets
- double pitchDeviance = rand.NextDouble() * System.Math.Tan(maxDevianceAngle * System.Math.PI / 180) * (maxRange - minRange) * rand.Next(-1, 2);
- double yawDeviance = rand.NextDouble() * System.Math.Tan(maxDevianceAngle * System.Math.PI / 180) * (maxRange - minRange) * rand.Next(-1, 2);
- //Construct destinations
- from = subpart2.WorldMatrix.Translation + subpart2.WorldMatrix.Forward * minRange;
- to = subpart2.WorldMatrix.Translation + subpart2.WorldMatrix.Forward * maxRange + subpart2.WorldMatrix.Left * yawDeviance + subpart2.WorldMatrix.Up * pitchDeviance;
- fromLB = subpart2.WorldMatrix.Translation + subpart2.WorldMatrix.Forward * minRange + subpart2.WorldMatrix.Left * horizOffset;
- fromRB = subpart2.WorldMatrix.Translation + subpart2.WorldMatrix.Forward * minRange + subpart2.WorldMatrix.Right * horizOffset;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement