C# 使用操纵杆在球体上旋转玩家
我想在一个统一的球体上旋转我的播放器,并使用此代码来旋转它,但它在球体上的某些位置工作,有人能帮助解决这个问题吗?或观看问题视频的链接C# 使用操纵杆在球体上旋转玩家,c#,unity3d,C#,Unity3d,我想在一个统一的球体上旋转我的播放器,并使用此代码来旋转它,但它在球体上的某些位置工作,有人能帮助解决这个问题吗?或观看问题视频的链接 using UnityEngine; using UnityStandardAssets.CrossPlatformInput; public class Follow_guide_pos : MonoBehaviour { private Vector3 input; void Update () { //rotation
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);
}
}
这是问题的视频。0:03-0:07飞机正在正确旋转
但在向另一个方向移动之后,它在另一个轴上旋转,或者不像以前那样旋转 注视功能采用向上方向,以帮助它将对象对准所需的方向。当您在球体周围移动时,车辆的真实高度正在发生变化。因此,您需要更改LookAt中的上方向向量,以匹配所需的车辆上方向