public void Setup(MotionController controller) { m_controller = controller; if (m_rigidbody == null) { m_rigidbody = m_controller.GetComponent <Rigidbody>(); } if (m_transform == null) { m_transform = m_controller.Transform; } }
void MakeAnalysis() { if (m_controller.Transform == null) { m_controller.Transform = m_controller.GetComponent <Transform>(); } if (m_bodyRef == null) { var go = new GameObject(m_controller.name + "_reference"); m_bodyRef = go.transform; m_bodyRef.position = m_controller.Transform.position; } var obj = Clips[m_currentAnimation]; var analizer = new MotionAnalyzer(); analizer.Init(m_controller, obj, m_bodyRef, m_ignoreRootMotion, m_samples); analizer.Analyze(); var data = analizer.ToAnalisisData(); data.Clip = obj.Clip; data.Index = m_currentAnimation; data.FixFootSkating = obj.FixFootSkating; data.Stationary = obj.Stationary; if (!obj.Stationary) { MotionAsset.MovingCount++; } else { MotionAsset.StationaryCount++; } MotionAsset.MotionCount++; MotionAsset.MotionData[m_currentAnimation] = data; m_controller.Transform.position = m_originalPosition; m_controller.Transform.rotation = m_originalRotation; }