简体   繁体   English

释放动画中的对象(Unity)

[英]Releasing objects in animations (Unity)

I have made an animation in 3ds max where a human holds a spear and throws it. 我已经在3ds max中制作了动画,其中有人握住长矛并将其投掷。 Then I imported it to Unity. 然后,将其导入到Unity。 I tried to detach/disconnect the spear during the animation with spear.transform.parent = null; 我在动画过程中尝试使用spear.transform.parent = null;分离/断开矛spear.transform.parent = null; . The spear doesn't release, however. 但是长矛没有释放。 I believe it could be because of the connection to the animation. 我相信可能是由于与动画的联系。 Anyway, I have made a connection between the spear and the skeleton in 3ds max. 无论如何,我已经在3ds max中使矛和骨骼之间建立了联系。 In 3ds max, the spear doesn't actually release from the hand, which is intended. 在3ds max中,矛实际上并没有从手中释放出来,这是有意的。

I am very much looking forward to your replies. 我非常期待您的答复。

Thanks in advance. 提前致谢。

You don't want your 3ds max animation to contain any updates for the spear you just want to animate the "hand" which will hold the spear and the rest of the body. 您不希望3ds max动画包含对矛的任何更新,而只想动画化将保留矛和身体其余部分的“手”。

Once you import the animation the spear is made a child of the hand. 导入动画后,矛即成为手的子代。 This way it will follow the hand so long as it's a child (normal parent/child gameobject behaviour), as soon as you unparent the spear it will not be getting any updates from the animation and not have a parent to follow (and you can apply a force or activate it's own movement script or whatever). 这样,只要是孩子(正常的父/子游戏对象行为),它将一直跟随该手,一旦您取消对矛的父视,它将不会从动画中获得任何更新,也没有父可以跟随(您可以施加力或激活它自己的运动脚本或其他命令)。

Depending on how your model is setup you might need a "holding point" bone rather than using the "hand" bone to resolve issues with rotation/positioning the carried item. 根据模型的设置方式,您可能需要“固定点”骨骼,而不是使用“手”骨骼解决旋转/放置所携带物品的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM