Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- /// Whip's Rangefinder Script v1.1 - 9/20/15 ///
- Made for the GAW Platform
- */
- string mergeName ="Merge - Type A (GAW1)"; //vector head
- string timerName = "Timer - Projectile Selecter (GAW1)"; //vector tail
- string projectorName = "Projector - Reticle Aperture (Right)";
- string rotorName = "Rotor - Reticle (Right) (GAW1)";
- double projectorOffset;
- double rotorOffset;
- void Main()
- {
- var projector = GridTerminalSystem.GetBlockWithName(projectorName) as IMyProjector;
- var rotor = GridTerminalSystem.GetBlockWithName(rotorName) as IMyMotorStator;
- var shipVectorTail = GridTerminalSystem.GetBlockWithName(timerName);
- var shipVectorHead = GridTerminalSystem.GetBlockWithName(mergeName);
- projectorOffset = (double)projector.ProjectionOffsetZ;
- rotorOffset = (double)rotor.Displacement + .045; //.045 is rotor offset factor
- double A = 5;
- double B = 5 + .5 * projectorOffset;
- double C = 5 - rotorOffset;
- double D = A-C; //XD double d's hehe... i need help
- if (D > 0)
- {
- double distance = A*B/D;
- Echo("Distance: " + distance.ToString());
- }else{
- Echo("Distance: Infinity");
- }
- Vector3D shipVectorHeadPos = new Vector3D(0, 0, 0);
- Vector3D shipVectorTailPos = new Vector3D(0, 0, 0);
- Vector3D shipVectorFinal = new Vector3D(0, 0, 0);
- shipVectorHeadPos = shipVectorHead.GetPosition();
- shipVectorTailPos = shipVectorTail.GetPosition();
- shipVectorFinal = shipVectorHeadPos - shipVectorTailPos;
- //cast distance onto this
- Echo("\nVector: " + shipVectorFinal.ToString());
- Echo("\n Projector Offset: " + projectorOffset.ToString());
- Echo("\n Rotor Offset: " + rotorOffset.ToString());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement