Exemplo n.º 1
0
 public void MoveCharacterController(Vector3 deltaPosition)
 {
     if (m_CharacterController != null && deltaPosition.sqrMagnitude < k_SqrMaxCharacterMovement)
     {
         Vector3 lMoveDirection = m_CharacterController.CalculateTargetDirection();
         float   lMoveSpeed     = m_CharacterController.GetComponent <Animator>()
                                  .GetFloat(AnimatorHash.MoveSpeed);
         Rigidbody lRigidbody = m_CharacterController.GetComponent <Rigidbody>();
         lRigidbody.MovePosition(lRigidbody.position + deltaPosition + lMoveDirection * (lMoveSpeed * Time.fixedDeltaTime));
     }
 }