Ejemplo n.º 1
0
        public void PanFocus(Vector3f v)
        {
            // figure out the pan that we would apply to camera, then apply the delta to the scene
            Vector3f curPos = UseCamera.GetPosition();
            Vector3f curDir = UseCamera.GetWorldFrame().Z;
            float    fDist  = Vector3.Dot((v - curPos), curDir);
            Vector3f newPos = v - fDist * curDir;
            Vector3f delta  = curPos - newPos;

            StartCoroutine(
                SmoothTranslate(UseScene.RootGameObject.GetPosition() + delta, 0.5f));
            StartCoroutine(
                SmoothMoveTarget(v + delta, 0.1f));
        }
Ejemplo n.º 2
0
        // should not use this anymore...
        public void PanFocus(Vector3f focusPoint, CoordSpace eSpace = CoordSpace.WorldCoords, float duration = 0.5f)
        {
            Vector3f focusPointW = (eSpace == CoordSpace.WorldCoords) ? focusPoint : UseScene.ToWorldP(focusPoint);

            // figure out the pan that we would apply to camera, then apply the delta to the scene
            Vector3f curPos = UseCamera.GetPosition();
            Vector3f curDir = UseCamera.GetWorldFrame().Z;
            float    fDist  = Vector3.Dot((focusPointW - curPos), curDir);
            Vector3f newPos = focusPointW - fDist * curDir;
            Vector3f delta  = curPos - newPos;

            StartCoroutine(
                SmoothTranslate(UseScene.RootGameObject.GetPosition() + delta, duration));
            StartCoroutine(
                SmoothMoveTarget(focusPointW + delta, duration / 10.0f));
        }