【发布时间】:2018-10-17 06:11:26
【问题描述】:
我想在一个球体上统一旋转我的播放器并使用此代码旋转它,但它适用于球体上的某些位置,有人可以帮助解决这个问题吗?或click 观看问题视频的链接。
using UnityEngine;
using UnityStandardAssets.CrossPlatformInput;
public class Follow_guide_pos : MonoBehaviour {
private Vector3 input;
void Update () {
//rotation of player input
input = new Vector3(CrossPlatformInputManager.GetAxisRaw("Horizontal_rot"),CrossPlatformInputManager.GetAxisRaw("Vertical_rot"),0);
}
void FixedUpdate(){
//rotation of player output
transform.LookAt(transform.position+input,transform.up);
}
}
Link to the video 是问题的视频。 0:03-0:07 飞机正确旋转 但是在将其沿其他方向移动后,它会在不同的轴上旋转或不像以前那样旋转。
【问题讨论】: