Exemplo n.º 1
0
        private IEnumerator EndMoveRoutine(VesselBounds vesselBounds)
        {
            Vessel v = vesselBounds.vessel;

            if (!v)
            {
                yield break;
            }

            yield return(new WaitForFixedUpdate());

            vesselBounds.UpdateBounds();

            yield return(new WaitForFixedUpdate());

            while (_moveMode != MoveModes.Normal)
            {
                ToggleMoveMode();
            }

            _moving    = false;
            MoveHeight = 0;
            _placingVessels.Add(vesselBounds.vessel);
            float bottomLength = _vBounds.BottomLength;

            //float heightOffset = GetRadarAltitude(movingVessel) - moveHeight;

            float altitude = GetRaycastAltitude(vesselBounds);

            while (v && !v.LandedOrSplashed)
            {
                v.IgnoreGForces(240);
                MovingVessel.IgnoreGForces(240);

                _up = (v.transform.position - FlightGlobals.currentMainBody.transform.position).normalized;
                float placeSpeed = Mathf.Clamp(((altitude - bottomLength) * 2), 0.1f, maxPlacementSpeed);
                if (placeSpeed > 3)
                {
                    v.SetWorldVelocity(Vector3.zero);
                    MovingVessel.angularVelocity = Vector3.zero;
                    MovingVessel.angularMomentum = Vector3.zero;
                    v.Translate(placeSpeed * Time.fixedDeltaTime * -_up);
                }
                else
                {
                    v.SetWorldVelocity(placeSpeed * -_up);
                }
                altitude -= placeSpeed * Time.fixedDeltaTime;
                yield return(new WaitForFixedUpdate());
            }

            _placingVessels.Remove(v);
            _hoverAdjust = 0f;
        }
Exemplo n.º 2
0
 private void UpdateBounds()
 {
     _hasRotated = false;
     _vBounds.UpdateBounds();
     _timeBoundsUpdated = Time.time;
 }
Exemplo n.º 3
0
        IEnumerator EndMoveRoutine(VesselBounds vesselBounds)
        {
            Vessel v = vesselBounds.vessel;
            if(!v) yield break;

            yield return new WaitForFixedUpdate();
            vesselBounds.UpdateBounds();

            yield return new WaitForFixedUpdate();

            while(moveMode != MoveModes.Normal)
            {
                ToggleMoveMode();
            }

            moving = false;
            moveHeight = 0;
            placingVessels.Add(vesselBounds.vessel);
            float bottomLength = vBounds.bottomLength;

            //float heightOffset = GetRadarAltitude(movingVessel) - moveHeight;

            float altitude = GetRaycastAltitude(vesselBounds);

            while(v && !v.LandedOrSplashed)
            {
                up = (v.transform.position-FlightGlobals.currentMainBody.transform.position).normalized;
                float placeSpeed = Mathf.Clamp(((altitude-bottomLength)*2), 0.1f, maxPlacementSpeed);
                if(placeSpeed > 3)
                {
                    v.SetWorldVelocity(Vector3.zero);
                    movingVessel.angularVelocity = Vector3.zero;
                    movingVessel.angularMomentum = Vector3.zero;
                    v.Translate(placeSpeed*Time.fixedDeltaTime * -up);
                }
                else
                {
                    v.SetWorldVelocity(placeSpeed * -up);
                }
                altitude -= placeSpeed*Time.fixedDeltaTime;
                yield return new WaitForFixedUpdate();
            }

            placingVessels.Remove(v);
        }