简体   繁体   English

Unity3d角色无法水平移动

[英]Unity3d Character failing to move horizontal

Maybe it is because if been trying to fix it for a few hours now. 也许是因为如果现在尝试修复几个小时。 But my character is not moving horizontaly. 但是我的角色不是水平移动。

First I was useing a cube as character to write it. 首先,我使用多维数据集作为字符来编写它。 When I replaced this cube with a player model it still moved up and down but not left and right anymore. 当我用播放器模型替换此多维数据集时,它仍然会上下移动,但不再左右移动。 Even after 2 hours of trying to figure it out I really couldnt stand it anymore and decided to post it on here. 即使经过2个小时的尝试,我仍然无法忍受,并决定将其发布在这里。

Due to the long code I decided to paste it in pastebin. 由于代码太长,我决定将其粘贴到pastebin中。

http://pastebin.com/iAsN51rW http://pastebin.com/iAsN51rW

thanks in advance 提前致谢

I found the solution to my problem. 我找到了解决我问题的方法。 And just like I thought, When Switching to my player model I had to change the movement direction from 就像我想的那样,当切换到播放器模型时,我必须将移动方向从

transform.Translate(speed* Time.deltaTime,0,0);

to

transform.Translate(0,0,speed* Time.deltaTime);

As my cube was looking At the camera , But my player was looking towards the sides 当我的立方体看着相机时,但我的播放器朝侧面看

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

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