Exemplo n.º 1
0
        void Main(string argument)
        {
            if (isfirst2)
            {
                //beginningvel = ship.Velocity;                       
                isfirst2 = false;
            }
            if (isfirst)
            {
                Vector3D targ = new Vector3D(0, -60000, 0);

                remote = GridTerminalSystem.GetBlockWithName("Remote");
                timer = GridTerminalSystem.GetBlockWithName("Timer");
                ship.Multiplier = Multiplier;
                ship = new SingleAxisThrustShip(remote, GridTerminalSystem, this);
                // ship.planet = planet;       
                ship.planet = Planet.ALIEN;
                //ship.Mass = 959798 - ship.GetMassSummary();          
                ship.Target = (new Vector3D(-100, 0, 0)) + remote.GetPosition();
                //arm = new ArmController(ship, "Shoulder Yaw", "Shoulder Pitch", "Elbow", "Wrist Pitch", "Wrist Yaw");
                isfirst = false;
                isfirst2 = true;
                // panel = (IMyTextPanel)GridTerminalSystem.GetBlockWithName("LCDebug");          
                //arm.extensionOffsetAngle = Math.PI / 2;
                targvel = remote.WorldMatrix.Forward * 10;
                //InteropManager.Add(new InterpOperation(arm, Vector3D.Transform(new Vector3D(10, 5, 0), arm.shoulderYaw.WorldMatrix), 0, 0));
                //InteropManager.Add(new InterpOperation(arm, remote.GetPosition(), 0, 0));
            }
            switch (argument)
            {
                case "Measure":
                    xs.Add(remote.GetPosition());
                    ds.Add(Vector3D.Normalize((remote as IMyRemoteControl).GetNaturalGravity()));
                    break;
                default:


                    if (!comfound)
                    {
                        // comfound = ship.TestForInitialCoM();          
                    }




                    if (xs.Count >= 2)
                    {
                       // Center = Planet.CalcCenterOfPlanet(xs, ds);
                    }
                    double poop = 0;
                    double pee = 0;
                    //test = arm.setArm(Vector3D.Transform(new Vector3D(10, 5, 0), arm.shoulderYaw.WorldMatrix), 0, 0);  
                    // Echo((Vector3D.Transform(arm.FindPos(out poop,out pee), MatrixD.Invert(arm.shoulderYaw.WorldMatrix))).ToString());  

                    //InteropManager.Tick();
                    //     //Vector3D.Transform(new Vector3D(3, 0, 0), arm.shoulderYaw.WorldMatrix)        


                    //new Vector3D(0,0, 9), arm.shoulderYaw.WorldMatrix)        

                    //ship.WriteToScreen(ship.GetDisplayString(), "LCDebug", false);          

                    Matrix orient;
                    remote.Orientation.GetMatrix(out orient);

                    MatrixD InvWorld = MatrixD.Invert(MatrixD.CreateFromDir(remote.WorldMatrix.
                    Forward, remote.WorldMatrix.Forward));

                    //  if (!test)
                    //  {
                    //      ship.SetDampeners(false);
                    ship.MaintainVelocity(Vector3D.Normalize((remote as IMyRemoteControl).GetNaturalGravity()) * 1.2);
                    // }
                    // else
                    //  {
                    //      ship.SetDampeners(true);
                    //  }
                    break;
            }
            //ship.set_oriented_gyros_planet(targ, new Vector3D(0, 0, 0), orient.Right);                           
            if ((timer as IMyFunctionalBlock).Enabled)
            {
                timer.GetActionWithName("TriggerNow").Apply(timer);
            }

        }
Exemplo n.º 2
0
        void Main(string argument)
        {
            switch (argument)
            {
                case "Dampen":
                    test = true;
                    break;
                default:
                    if (isfirst2)
                    {
                        //beginningvel = ship.Velocity;    
                        isfirst2 = false;
                    }
                    if (isfirst)
                    {
                        //Vector3D targ = new Vector3D(0, -60000, 0);

                        remote = GridTerminalSystem.GetBlockWithName("Remote");
                        timer = GridTerminalSystem.GetBlockWithName("Timer");

                        ship = new SingleAxisThrustShip(remote, GridTerminalSystem, this);
                        ship.Target = targ;
                        isfirst = false;
                        isfirst2 = true;
                        panel = (IMyTextPanel)GridTerminalSystem.GetBlockWithName("LCDebug");
                        

                    }





                    //Echo(foundCenter.ToString());   


                   // double dist = Ship.SphericalDist(remote.GetPosition(), ship.Target, foundCenter, remote.GetPosition().Length());
                    // double longitude = ship.GetLongitude(remote.GetPosition()) * 57.2958;    
                    // double latitude = ship.GetLatitude(remote.GetPosition()) * 57.2958;    
                    // double heading = ship.GetCurrentHeading() * 57.2958;    
                    //Vector3D kek = ship.Velocity;    
                    //ship.WriteToScreen(ship.GetDisplayString() + "\nDistance From Center: " + remote.GetPosition().Length(), "LCDebug", false);
                    //Vector3D ForwardVel = Projection(kek, remote.WorldMatrix.Forward);    
                    // Echo(ForwardVel.Length().ToString());    
                    Matrix orient;
                    remote.Orientation.GetMatrix(out orient);
                    // ship.set_oriented_gyros(new Vector3D(0, 0, 0), orient.Down);       
                    //Echo(ship.GetMassTemp().ToString());                
                    MatrixD InvWorld = MatrixD.Invert(MatrixD.CreateFromDir(remote.WorldMatrix.
                    Forward, remote.WorldMatrix.Forward));
                    // if (dist > 800)
                    // if (ship.SetForwardVelocity_Planet(100)) test = true;
               
                    //if(ship.ThrustTowardsVector(-Vector3D.Normalize(remote.GetPosition()))) timer.GetActionWithName("OnOff_Off").Apply(timer); ;                
      
            }
            //ship.set_oriented_gyros_planet(targ, new Vector3D(0, 0, 0), orient.Right);        
            if ((timer as IMyFunctionalBlock).Enabled)
            {
                timer.GetActionWithName("TriggerNow").Apply(timer);
            }

        }