Пример #1
0
        public ConstraintSource(Transform t, SourceCoordinates coords, Transform modelRoot = null)
        {
            m_transform = t;
            m_coords    = coords;

            switch (coords)
            {
            case SourceCoordinates.World:
                m_initial = TRS.GetWorld(t);
                break;

            case SourceCoordinates.Local:
                m_initial = TRS.GetLocal(t);
                break;

            case SourceCoordinates.Model:
            {
                var world = TRS.GetWorld(t);
                m_modelRoot = modelRoot;
                m_initial   = new TRS
                {
                    Translation = modelRoot.worldToLocalMatrix.MultiplyPoint(world.Translation),
                    Rotation    = world.Rotation * Quaternion.Inverse(m_modelRoot.rotation),
                };
            }
            break;

            default:
                throw new NotImplementedException();
            }
        }
Пример #2
0
        public ConstraintDestination(Transform t, DestinationCoordinates coords)
        {
            m_transform = t;
            m_coords    = coords;

            switch (m_coords)
            {
            case DestinationCoordinates.World:
                m_initial = TRS.GetWorld(t);
                break;

            case DestinationCoordinates.Local:
                m_initial = TRS.GetLocal(t);
                break;

            default:
                throw new NotImplementedException();
            }
        }
Пример #3
0
        public ConstraintDestination(Transform t, ObjectSpace coords)
        {
            m_transform = t;
            m_coords    = coords;

            switch (m_coords)
            {
            // case ObjectSpace.World:
            //     m_initial = TRS.GetWorld(t);
            //     break;

            case ObjectSpace.local:
                m_initial = TRS.GetLocal(t);
                break;

            default:
                throw new NotImplementedException();
            }
        }
Пример #4
0
        public ConstraintDestination(Transform t, ObjectSpace coords, Transform modelRoot = null)
        {
            m_transform = t;
            m_coords    = coords;

            switch (m_coords)
            {
            // case ObjectSpace.World:
            //     m_initial = TRS.GetWorld(t);
            //     break;

            case ObjectSpace.local:
                m_initial = TRS.GetLocal(t);
                break;

            case ObjectSpace.model:
                m_initial = TRS.GetRelative(t, modelRoot.worldToLocalMatrix);
                break;

            default:
                throw new NotImplementedException();
            }
        }