Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 旋转仅限于X轴?_C#_Unity3d - Fatal编程技术网

C# 旋转仅限于X轴?

C# 旋转仅限于X轴?,c#,unity3d,C#,Unity3d,我正在尝试编写应该播放的动画脚本。这是我现在所拥有的,然而,当我向后移动时,我得到的不是“后退”,而是“行走”。为什么呢 if (isRunning) animator.Play("run"); if(characterController.velocity.z < 0) animator.Play("walkBack"); if (!isRunning) animator.Play("walk"); i

我正在尝试编写应该播放的动画脚本。这是我现在所拥有的,然而,当我向后移动时,我得到的不是“后退”,而是“行走”。为什么呢

    if (isRunning)
        animator.Play("run");

    if(characterController.velocity.z < 0)
        animator.Play("walkBack");

    if (!isRunning)
        animator.Play("walk");

    if (characterController.velocity == Vector3.zero)
        animator.Play("idle");
if(正在运行)
动画师。播放(“跑步”);
if(characterController.velocity.z<0)
动画师。播放(“回放”);
如果(!正在运行)
动画师。播放(“行走”);
if(characterController.velocity==Vector3.zero)
动画师。播放(“空闲”);
编辑:忘了提到,当角色旋转时,只有角色模型(相机连接到头部,头部连接到身体)会旋转。CharacterController和脚本位于父对象上,父对象只移动,不旋转。我怎样才能知道孩子的方向


谢谢你

看起来isrunning为false,因此会覆盖回访

听起来跑步是错误的,它覆盖了你的步行选择。你是对的!非常感谢。我应该把它作为答案贴出来,这样我才能标记它!tbh这是一个太明显的答案:PSorry,它和跑步和走路一起工作,所以我认为它会像这样工作!无论如何谢谢你!谁不喜欢它,谁就喜欢它。他是对的!她!!!!啊!很抱歉互联网上的用户名几乎都是中性的。我是男性还是女性D