【发布时间】:2021-12-28 19:29:34
【问题描述】:
如果重复 - 我已经从 stackoverflow 阅读了其他帖子。它们中的大多数都与 Unity3D 相关联,其中很多都使用诸如 theta/omega .. 等关键字。我无法理解那些东西。另外,我对这些公式符号的了解为 0,所以我对所读内容的理解为 0%。
我尝试为视频游戏制作机器人,我唯一坚持的是如何获得所需的旋转度,直到我面对给定的坐标。在这里,我简单地举例说明了我的编程问题。
在这种情况下我知道的事情:
- 玩家 1 位置
- Player1 轮换
- Player2位置(我需要面对这个玩家)
2D map of the situation. Click here
这是它在 c# 中的样子
using System;
public class Program
{
// Player 1 cordinates
public static float p1x = 2;
public static float p1y = 3;
public static float p1rotation = 0; // In degrees 0-360
// Player 2 cordinates
public static float p2x = 6;
public static float p2y = 4;
// Player 1 needed degree to face Player 2
public static float needed_distance;
public static void Main()
{
needed_distance = ??; // no clue how to get this value ...
Console.WriteLine("The needed distance is: "+needed_distance);
}
}
请不要将此标记为重复,我的数学技能甚至低于零。如果有人试图用我做的例子来回答我,我会更好地理解。
【问题讨论】:
-
你是旋转后还是距离后?
-
旋转,我已经有了距离脚本