动画过渡统一 [英] Animation Transition Unity

查看:155
本文介绍了动画过渡统一的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何将游戏对象过渡到现有动画吗?

当前,我有一个像这样的多维数据集对象:

多维数据集对象具有具有固定位置的预先配置的简单跳跃动画,作为图层默认状态.让我们将此动画称为" BoxJumping ".

但是,播放器可以将多维数据集对象移动到任何位置(使用wsad键). 当播放器停止1秒钟时,我希望多维数据集过渡回动画的原始位置.像这样:

我可以简单地使用:

private void playJumpAnim()
{
   gameObject.GetComponent<Animation>().Play("BoxJumping");
}

但是,它只是将多维数据集直接移动到已存储在动画中的预配置位置,然后播放动画,而没有任何平滑过渡.

有人知道如何实现这种过渡吗?

解决方案

一个非常简单的解决方案是创建一个空的游戏对象作为多维数据集的父对象.当 Animator 是子级时,它将在本地空间上执行更新./p>

然后,您可以按父游戏对象移动立方体.

Does anyone know how to transition a game object to an existing animation?

Currently I have a cube object like this:

The cube Object has a preconfigured simple jumping animation with fixed location as Layer default state. Lets call this animation: "BoxJumping".

The player however can move the cube object to any position(using wsad) key. When the player stop for 1 sec, I want the cube to transition back to the original position of the animation. Like this:

I can simply use:

private void playJumpAnim()
{
   gameObject.GetComponent<Animation>().Play("BoxJumping");
}

However, it just directly move the cube to the preconfigure location which has been stored in the animation and play the animation without any smoothing transtion.

Does anyone know how to achieve this kind of transition?

解决方案

A very simple solution is create an empty gameobject to be parent of the cube. When the Animator is a child, it performs the updates on local space.

Then you can move the cube by the parent gameobject.

这篇关于动画过渡统一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆