private void FixedUpdate() { if (!m_canMove) { return; } if (m_t < m_curveController.GetDuration()) { m_t += Time.fixedDeltaTime * m_speed; } m_curveController.GetCurveValue(m_t, out Vector3 pos, out Quaternion quat); this.transform.position = pos; this.transform.rotation = quat; }
// Update is called once per frame void Update() { if (m_rootCurve.GetKeyNumber() < 2) { return; } Vector3 rootPos = m_character.m_root.transform.position; rootPos.y = 0; m_rootCurve.GetCurveValue(m_curveT, out Vector3 curvePos, out Quaternion curveQuat); Vector3 targetPos = curvePos; m_target.transform.position = targetPos; // Rotate the root towards the root target on the curve if (Vector3.Distance(rootPos, targetPos) < m_threshold && m_curveT <= m_rootCurve.GetDuration()) { m_curveT += Time.deltaTime; } }