Beispiel #1
0
        /// <summary>
        /// Rotate vessel if there is some
        /// </summary>
        private static void Rotate(Vessel v)
        {
            v.ResetCollisionIgnores();

            //var from = Vector3d.back; // [0,0,-1]
            var from = rotationVector;
            var to   = GeoUtils.GetTerrainNormal(v.latitude, v.longitude, v.altitude, v.mainBody);

            Quaternion rotation = Quaternion.FromToRotation(from, to);

            v.SetRotation(rotation);
        }
Beispiel #2
0
        public static void Rotate(Vessel v, Vector3d _rotation)
        {
            v.ResetCollisionIgnores();

            var from = _rotation;
            var to   = GeoUtils.GetTerrainNormal(v.latitude, v.longitude, v.altitude, v.mainBody);

            Quaternion rotation = Quaternion.FromToRotation(from, to);

            v.SetRotation(rotation);

            v.ResetGroundContact();
            v.IgnoreGForces(20);
            v.SetWorldVelocity(Vector3.zero);
            v.angularMomentum = Vector3.zero;
            v.angularVelocity = Vector3.zero;
            VesselSleep(v);
        }