Example #1
0
        /// <summary>
        /// Displays the anchor handles.
        /// </summary>
        /// <returns>
        /// <see langword="true"/>, if anchor handles was displayed, <see langword="false"/> otherwise.
        /// </returns>
        /// <param name="joint">Joint.</param>
        /// <param name="bindpose">Bindpose.</param>
        /// <returns><see langword="true"/> if the handles changed; otherwise, <see langword="false"/>.</returns>
        public static bool DisplayAnchorHandles(Joint joint, Matrix4x4 bindpose)
        {
            Vector3 anchor = joint.anchor;

            if (SceneGUI.BeginHandles(joint, "Change Anchor"))
            {
                Matrix4x4 oldMatrix = Handles.matrix;
                Handles.matrix = Matrix4x4.TRS(joint.transform.position, joint.transform.rotation, Vector3.one);
                anchor         = TransformHandles.Translation(
                    ObjectX.GenerateHashCode(joint.GetHashCode(), s_AnchorHandleHash), anchor, Quaternion.identity, 0.5f
                    );
                Handles.matrix = oldMatrix;
            }
            if (SceneGUI.EndHandles())
            {
                joint.anchor = anchor;
                return(true);
            }
            return(false);
        }