A MonoBehaviour that interpolates a transform's position, rotation or scale.
Наследование: UnityEngine.MonoBehaviour
Пример #1
0
        protected virtual void Start()
        {
            // Make sure the Tagalong object has a BoxCollider.
            tagalongCollider = GetComponent <BoxCollider>();

            // Get the Interpolator component and set some default parameters for
            // it. These parameters can be adjusted in Unity's Inspector as well.
            interpolator = gameObject.GetComponent <Interpolator>();
            interpolator.SmoothLerpToTarget      = SmoothMotion;
            interpolator.SmoothPositionLerpRatio = SmoothingFactor;
        }
        protected virtual void Start()
        {
            // Make sure the Tagalong object has a BoxCollider.
            tagalongCollider = GetComponent<BoxCollider>();

            // Get the Interpolator component and set some default parameters for
            // it. These parameters can be adjusted in Unity's Inspector as well.
            interpolator = gameObject.GetComponent<Interpolator>();
            interpolator.SmoothLerpToTarget = SmoothMotion;
            interpolator.SmoothPositionLerpRatio = SmoothingFactor;
        }
Пример #3
0
        private void BeginManipulation()
        {
            if (GestureManager.Instance != null && GestureManager.Instance.ManipulationInProgress)
            {
                Manipulating = true;

                targetInterpolator = gameObject.GetComponent <Interpolator>();

                // In order to ensure that any manipulated objects move with the user, we do all our math relative to the camera,
                // so when we save the initial hand position and object position we first transform them into the camera's coordinate space
                initialHandPosition   = Camera.main.transform.InverseTransformPoint(GestureManager.Instance.ManipulationHandPosition);
                initialObjectPosition = Camera.main.transform.InverseTransformPoint(transform.position);
            }
        }
Пример #4
0
        private void BeginManipulation(InteractionSourceKind sourceKind)
        {
            // Check if the gesture manager is not null, we're currently focused on this Game Object, and a current manipulation is in progress.
            if (gestureManager != null && gestureManager.FocusedObject != null && gestureManager.FocusedObject == gameObject && gestureManager.ManipulationInProgress)
            {
                Manipulating = true;

                targetInterpolator = gameObject.GetComponent <Interpolator>();

                // In order to ensure that any manipulated objects move with the user, we do all our math relative to the camera,
                // so when we save the initial manipulation position and object position we first transform them into the camera's coordinate space
                initialManipulationPosition = Camera.main.transform.InverseTransformPoint(gestureManager.ManipulationPosition);
                initialObjectPosition       = Camera.main.transform.InverseTransformPoint(transform.position);
            }
        }
        private void BeginManipulation(InteractionSourceKind sourceKind)
        {
            // Check if the gesture manager is not null, we're currently focused on this Game Object, and a current manipulation is in progress.
            if (gestureManager != null && gestureManager.FocusedObject != null && gestureManager.FocusedObject == gameObject && gestureManager.ManipulationInProgress)
            {
                Manipulating = true;

                targetInterpolator = gameObject.GetComponent<Interpolator>();

                // In order to ensure that any manipulated objects move with the user, we do all our math relative to the camera,
                // so when we save the initial manipulation position and object position we first transform them into the camera's coordinate space
                initialManipulationPosition = Camera.main.transform.InverseTransformPoint(gestureManager.ManipulationPosition);
                initialObjectPosition = Camera.main.transform.InverseTransformPoint(transform.position);
            }
        }
        protected virtual void Start()
        {
            // Make sure the Tagalong object has a BoxCollider.
            tagalongCollider = GetComponent <BoxCollider>();

            // Get the Interpolator component and set some default parameters for
            // it. These parameters can be adjusted in Unity's Inspector as well.
            interpolator = gameObject.GetComponent <Interpolator>();
            interpolator.SmoothLerpToTarget      = SmoothMotion;
            interpolator.SmoothPositionLerpRatio = SmoothingFactor;

            if (TagAlongView == null)
            {
                Debug.Log("No Tagalong camera specified. Using main camera.");
                TagAlongView = Camera.main;
            }
            TagAlongView.orthographicSize = triggerDistance;
        }