Beispiel #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();
            }
        }
Beispiel #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();
            }
        }