碰撞器动画化

huangapple go评论101阅读模式
英文:

Collider Animating

问题

我制作了一个动画,当角色翻转时,它会移动碰撞器,但需要一点时间。
这是它的外观:
链接
如果你想问任何关于代码或我在Unity中设置的参数的问题。

我期望碰撞器能立即移动。

英文:

Ok so I made an animation that moves the collider when the character flips but it takes a little.
Here is how it looks like:
text
If you want to ask anything like the code, the parameters I put unity.

I expect the collider to move instantly

答案1

得分: 1

很难确定为什么它不会立即移动,除非有更多信息、脚本、动画设置和过渡。但我会假设这与动画的退出时间有关。退出时间可能会阻止动画立即切换到过渡动画剪辑,从而导致在切换之前出现短暂的时间段。

如果是因为动画的退出时间,你需要进入动画师,点击角色两侧的空闲动画箭头,然后关闭“具有退出时间”选项:

碰撞器动画化

如果这似乎不起作用,你总是可以创建两个不同的碰撞体。一个位于角色的每一侧,每当角色选择翻转时,你可以启用该侧的碰撞体。这可能会减少场景性能上的问题,几乎不会影响性能。

如果你已经探索了这些可能性,仍然无法确定根本原因,你可能需要考虑分享更多的代码或简化设置以缩小问题范围。

英文:

It is hard to determine why it does not move instantly without more information, scripts, animation setup and transitions. But I would assume it is related to the animation exit time. The exit time could be stopping the animation from swapping instantly to the transition animation clip causing that short period of time before swapping.

If it is the animation exit time, you would need to go to the Animator, click the arrow going from the idle animation on either side of the character and toggle off the "Has Exit Time" option:

碰撞器动画化

If that does not seem to work, you can always create two different colliders. One on either side of the character and whenever the character choses to flip, you can enable the collider on that side. This might cause less issues with little to no difference in the scenes performance.

If you've explored these possibilities and still can't identify the root cause, you might want to consider sharing more of your code or simplifying your setup to narrow down the issue.

huangapple
  • 本文由 发表于 2023年8月10日 18:29:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/76874885.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定