我有一个问题,我不知道如何使动画逻辑,也许如何团结剪辑之间的Animation tree where, each transition on jump is like Isjumping = true, then IsFalling = true etc.And if needed, my jump script
RaycastHit hit;
bool isFalling = Physics.Raycast(transform.position, transform.TransformDirection(Vector3.Normalize(_controller.velocity)), out hit, Mathf.Infinity, 1);
_animator.SetBool(_isJumpingHash, !_isGrounded);
if (isFalling)
{
if (hit.distance >= _raycastDistance && transform.TransformDirection(Vector3.Normalize(_controller.velocity)).y <= 0)
{
_animator.SetBool(_isFallingHash, true);
}
else
{
_animator.SetBool(_isLandingHash, true);
}
}
这是当前的汉尔德跳跃动画,但它不工作。
我的脚本是基于CharacterController的,我该怎么办?
我尝试了不同的方法从互联网上,但我的动画是不工作
1条答案
按热度按时间ruarlubt1#
虽然你的这个问题很宽泛,并没有涉及到一个具体的问题,这就是我标记它的原因。但是我想提醒你的关键点肯定会对你有用。正如你所知道的,随着动画师的发展,这种为每个状态创建参数的方法使得工作更加困难和复杂。所以你需要一种参数化的方法来保持动态,并在不同的部分为你工作。现在看看下面的代码。
上面我尝试直接将
yVelocity
传递给animator,而不是为isFalling
取布尔值。因为这使你在animator中有更多的自由。例如,如果下降速度增加,我们可以切换到另一个动画,或者isFalling
动画将自动工作的任何其他地方。现在已经足够确定可以在animator中输入的状态。yVelocity
小于-.1
)。isGrounded
设置为animator并为其设置相同的条件。hasExitTime
。