Beispiel #1
0
        protected override void OnExecute(ConnectorIn input)
        {
            //get target vector(navball)
            Vector3 v = In("Forward").AsVector3().GetVec3().normalized;
            //create rotation
            Quaternion rot  = Quaternion.LookRotation(v, Vector3.up) * Quaternion.Euler(90, 0, 0);
            Quaternion roll = Quaternion.identity;

            //keep absolute roll ?

            roll = Quaternion.AngleAxis(In("Roll").AsFloat(), v);

            rot = roll * rot;
            //apply sas target
            SASController.SASTarget = VesselController.ReferenceToWorld(rot, VesselController.FrameOfReference.Navball);
            ExecuteNext();
        }
Beispiel #2
0
        protected override void OnExecute(ConnectorIn input)
        {
            //get target vector(navball)
            Vector3 v = In("Forward").AsVector3().GetVec3().normalized;
            //create rotation
            Quaternion rot  = Quaternion.LookRotation(v, Vector3.up) * Quaternion.Euler(90, 0, 0);
            Quaternion roll = Quaternion.identity;
            //keep absolute roll ?
            //get navball horizontal angles
            float angleC = Mathf.Atan2(VesselController.NavballHeading.z, VesselController.NavballHeading.x);

            float angleT = Mathf.Atan2(v.z, v.x);

            //delta of angles
            float d = Mathf.DeltaAngle(angleC, angleT) * Mathf.Rad2Deg;

            //add delta to current angle
            roll = Quaternion.AngleAxis((float)VesselController.Roll + d, v);

            rot = roll * rot;
            //apply sas target
            SASController.SASTarget = VesselController.ReferenceToWorld(rot, VesselController.FrameOfReference.Navball);
            ExecuteNext();
        }
Beispiel #3
0
        protected override void OnUpdateOutputData()
        {
            var worldDeref = VesselController.ReferenceToWorld(In("WorldLocation").AsVector3().GetVec3(), VesselController.FrameOfReference.Navball);

            Out("GeoLocation", new SVector3d(VesselController.WorldToGeo(worldDeref)));
        }