Exemplo n.º 1
0
    /// <summary>
    /// Rotate node's colider though controls
    /// </summary>
    void ProcessRotation(Quaternion rotatorRotation, Transform transform, Vector3 pos)
    {
        Quaternion newRotation;
        bool       changed;

        if (Tools.pivotRotation == PivotRotation.Global)
        {
            Quaternion fromStart = rotatorRotation * Quaternion.Inverse(_lastRotation);
            newRotation = Handles.RotationHandle(fromStart, pos);
            changed     = fromStart != newRotation;
            newRotation = newRotation * _lastRotation;
        }
        else
        {
            newRotation = Handles.RotationHandle(rotatorRotation, pos);
            changed     = rotatorRotation != newRotation;
        }

        if (changed)
        {
            transform = AutoRagdollUtility.GetRotatorTransform(transform);
            AutoRagdollUtility.RotateCollider(transform, newRotation);
        }
    }