Пример #1
0
            public void Initiate(Vector3 childPosition, Vector3 bendNormal)
            {
                Quaternion rotation = Quaternion.LookRotation(childPosition - this.transform.position, bendNormal);

                this.targetToLocalSpace     = QuaTools.RotationToLocalSpace(this.transform.rotation, rotation);
                this.defaultLocalBendNormal = Quaternion.Inverse(this.transform.rotation) * bendNormal;
            }
            /*
             * Initiates the bone, precalculates values.
             * */
            public void Initiate(Vector3 childPosition, Vector3 bendNormal)
            {
                // Get default target rotation that looks at child position with bendNormal as up
                Quaternion defaultTargetRotation = Quaternion.LookRotation(childPosition - transform.position, bendNormal);

                // Covert default target rotation to local space
                targetToLocalSpace = QuaTools.RotationToLocalSpace(transform.rotation, defaultTargetRotation);

                defaultLocalBendNormal = Quaternion.Inverse(transform.rotation) * bendNormal;
            }
Пример #3
0
            /*
             * Updates the 3 plane points
             * */
            public void UpdatePlane(bool rotation, bool position)
            {
                Quaternion t = lastAnimatedTargetRotation;

                if (rotation)
                {
                    defaultLocalTargetRotation = QuaTools.RotationToLocalSpace(transform.rotation, t);
                }
                if (position)
                {
                    planePosition = Quaternion.Inverse(t) * (transform.position - planeBone1.position);
                }
            }
Пример #4
0
            public void UpdatePlane(bool rotation, bool position)
            {
                Quaternion lastAnimatedTargetRotation = this.lastAnimatedTargetRotation;

                if (rotation)
                {
                    this.defaultLocalTargetRotation = QuaTools.RotationToLocalSpace(this.transform.rotation, lastAnimatedTargetRotation);
                }
                if (position)
                {
                    this.planePosition = Quaternion.Inverse(lastAnimatedTargetRotation) * (this.transform.position - this.planeBone1.position);
                }
            }