Exemple #1
0
        /// <summary>
        /// SourceのUpdateよりも先か後かはその時による。
        /// 厳密に制御するのは無理。
        /// </summary>
        void Update()
        {
            if (Source == null)
            {
                enabled = false;
                return;
            }

            if (m_src == null)
            {
                m_src = new ConstraintSource(Source, SourceCoordinate, ModelRoot);
            }
            if (m_dst == null)
            {
                m_dst = new ConstraintDestination(transform, DestinationCoordinate);
            }

            // 軸制限をしたオイラー角
            var delta    = m_src.RotationDelta;
            var fleezed  = FreezeAxes.Freeze(delta.eulerAngles);
            var rotation = Quaternion.Euler(fleezed);

            Debug.Log($"{delta} => {rotation}");
            // オイラー角を再度Quaternionへ。weight を加味してSlerpする
            m_dst.ApplyRotation(rotation, Weight);
        }
Exemple #2
0
        void Update()
        {
            if (Source == null)
            {
                enabled = false;
                return;
            }

            if (m_src == null)
            {
                m_src = new ConstraintSource(Source, SourceCoordinate, ModelRoot);
            }
            if (m_dst == null)
            {
                m_dst = new ConstraintDestination(transform, DestinationCoordinate);
            }

            var delta = FreezeAxes.Freeze(m_src.TranslationDelta);

            m_dst.ApplyTranslation(delta, Weight);
        }
Exemple #3
0
 /// <summary>
 /// Editorで設定値の変更を反映するために、クリアする
 /// </summary>
 void OnValidate()
 {
     Debug.Log("Validate");
     m_src = null;
     m_dst = null;
 }