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# Unity 2d-我想删除自上而下游戏中图像的旋转_C#_Unity3d - Fatal编程技术网

C# Unity 2d-我想删除自上而下游戏中图像的旋转

C# Unity 2d-我想删除自上而下游戏中图像的旋转,c#,unity3d,C#,Unity3d,我想修改代码 因此,图像在转换到下一点时不会旋转 我试着把它修好,但做不到 对我的写作错误表示歉意,我不会说英语 [序列化字段] 私有转换点; 转换点; 国际贸易指数; 受保护的覆盖无效开始() { 当前指数=0; currentPatrolPoint=巡逻点[currentPatrolIndex]; base.Start(); } 受保护的覆盖无效更新() { transform.Translate(Vector3.up*Time.deltaTime*MySpeed); 如果(Vector

我想修改代码 因此,图像在转换到下一点时不会旋转 我试着把它修好,但做不到

对我的写作错误表示歉意,我不会说英语

[序列化字段]
私有转换点;
转换点;
国际贸易指数;
受保护的覆盖无效开始()
{
当前指数=0;
currentPatrolPoint=巡逻点[currentPatrolIndex];
base.Start();
}
受保护的覆盖无效更新()
{
transform.Translate(Vector3.up*Time.deltaTime*MySpeed);

如果(Vector3.Distance(transform.position,currentPatrolPoint.position)如果您不想让它旋转,请移除旋转游戏对象的此部分:

float angle = Mathf.Atan2(patrolPointDirection.y, patrolPointDirection.x) * Mathf.Rad2Deg - 90f;
Quaternion q = Quaternion.AngleAxis(angle, Vector3.forward);
transform.rotation = Quaternion.RotateTowards(transform.rotation, q,180f);

也可以从代码中删除仅用于transform.rotation的任何变量。

因此,您希望图像旋转还是不旋转?在您的文本中,您会说:所以不要将图像转到下一点。但稍后在代码中使用transform.rotation我希望图片转到下一点,但不要围绕其自身旋转你能解决这个问题吗?