/// <summary>
/// 设置方向
/// </summary>
/// <param name="moveForward">相机到角色的方向</param>
/// <param name="inputDir">键盘输入方向</param>
void SetDir(Vector3 moveForward, Vector3 inputDir)
{
if (inputDir.magnitude > 0)
{
Vector3 moveRight = new Vector3(moveForward.z, moveForward.y, -moveForward.x);
Vector3 getDir = (moveForward * inputDir.z + moveRight * inputDir.x).normalized;
transform.forward = getDir;
}
}
第三人称以相机到角色为正方向的8方向设置
最新推荐文章于 2020-12-21 00:57:44 发布