本地位置动画
我试图做到这一点:
角色走到一个大板条箱前,玩家按下 e 键,动画开始播放,这样角色就会爬上板条箱。 (全部以第一人称视角)。
到目前为止,我在 Unity 中使用正常的“第一人称控制器”预制件进行了尝试。
到目前为止我的代码:
function OnTriggerStay(other : Collider){
if(other.tag == "GrabZone"){
if(Input.GetKeyDown("e")){
animation.Play("JumpToLedge");
}
}
}
但是,当我在 FPC 上使用它时,它将始终从创建动画的位置播放。我还尝试创建一个空的游戏对象,将 FPC 放置在那里。给出相同的效果。
最近,我尝试仅对 FPC 的图形进行动画处理。这似乎有效,但由于角色控制器本身没有动画,因此它停留在地面上。这样整个FPC就不能用了。
无论如何,我可以让这个动画在玩家当时所在的本地位置上播放吗?或者你能想到任何其他合乎逻辑的抓取和攀爬解决方案吗?
I am trying to make this:
The chracter walks up to a large crate, the player presses the e key and an animation starts playing, such that the character climbs up on to the crate. (all in first person view).
So far I tried this with normal "First Person Controller" Prefab in Unity.
My code so far:
function OnTriggerStay(other : Collider){
if(other.tag == "GrabZone"){
if(Input.GetKeyDown("e")){
animation.Play("JumpToLedge");
}
}
}
However when I use this on the FPC, it will always play from the position the animation is created on. I also tried to create an empty game object, placing the FPC in there. Gives same effect.
Most recently, I tried just animating the graphics of the FPC alone. This seems to work, but since the Character Controller itself is not animated, that stays on the ground. So the whole FPC won't work anymore.
Is there anyway I could let this animation play on the local position the player is on at that time? Or can you think of any other logical solution for a grab and climb?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该始终从 0,0 位置开始制作动画。通过这种方式,您始终可以轻松地确定模型要做什么以及去哪里。
You should always animate from the 0,0 position. This way you can always easilyl determine what to do and where to go with your model.