示例#1
0
        /// <summary>
        /// Updates references to Transform objects that we're interested in.
        /// </summary>
        private void UpdateTransformReferences()
        {
            Transform newParent;

            if (relativeTrn == null)
            {
                if (FlightGlobals.ActiveVessel == null)
                {
                    newParent = null;
                }
                else
                {
                    newParent = FlightGlobals.ActiveVessel.transform;
                }
            }
            else
            {
                newParent = relativeTrn;
            }
            TransformState.MoveToParent(destructionProxy.transform, newParent);
            TransformState.ResetTransformToIdentity(destructionProxy.transform);
            TransformState.ResetTransformToIdentity(transform);

            // For FlightCamera, the second transform is that for the FlightCamera itself.
            secondTrn = new TransformState(FlightCamera.fetch.transform);
            // ... and the transform parent is the "main camera pivot".
            firstTrn = new TransformState(secondTrn.Transform.parent);
        }
示例#2
0
        private void ReplaceProxy()
        {
            if (destructionProxy != null)
            {
                destructionProxy.onDestroy -= this.OnProxyDestroyed;
            }
            GameObject obj = new GameObject("KerbCam.CameraController DestructionProxy");

            destructionProxy            = obj.AddComponent <DestructionProxy>();
            destructionProxy.onDestroy += OnProxyDestroyed;
            TransformState.MoveToParent(transform, destructionProxy.transform);
        }
示例#3
0
        private void ReacquireFlightCamera()
        {
            if (!isControlling)
            {
                return;
            }

            FlightCamera.fetch.DeactivateUpdate();

            UpdateTransformReferences();

            // Store the first and second transform states, for when we release the camera.
            firstTrn.Store();
            secondTrn.Store();

            // The CameraController becomes the parent transform for the camera transforms.
            TransformState.MoveToParent(firstTrn.Transform, transform);
        }