Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.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# 获得李萨如135°;C中的曲线#_C# - Fatal编程技术网

C# 获得李萨如135°;C中的曲线#

C# 获得李萨如135°;C中的曲线#,c#,C#,我实际上是想在Unity 5的C#脚本中得到一条李萨如曲线 这是从左中部开始的第四条135°曲线。我已经实现了45°曲线,但我无法在我的C#脚本中得到它的反转变量,因为这个“3π”似乎无法用Mathf.PI重现 我尝试了((Mathf.PI*3)/4)和((Mathf.PI+Mathf.PI+Mathf.PI)/4),但没有成功。这条曲线不是我想要的 以下是我已经实现的45°曲线的代码: float xU = 0, yU = 0; yU += yLissajousU *

我实际上是想在Unity 5的C#脚本中得到一条李萨如曲线

这是从左中部开始的第四条135°曲线。我已经实现了45°曲线,但我无法在我的C#脚本中得到它的反转变量,因为这个“3π”似乎无法用Mathf.PI重现

我尝试了((Mathf.PI*3)/4)和((Mathf.PI+Mathf.PI+Mathf.PI)/4),但没有成功。这条曲线不是我想要的

以下是我已经实现的45°曲线的代码:

        float xU = 0, yU = 0;
    yU += yLissajousU * Mathf.Sin ((lissajousUSwaySpeed * 2) * Time.time);
    xU += xLissajousU * Mathf.Sin (lissajousUSwaySpeed * Time.time + Mathf.PI / 4);
我相信这很简单,但就在昨天,我实现了45°曲线脚本,这是我第一次自己编写代码

非常感谢您的帮助。

我找到了解决方案

        float xA = 0, yA = 0;
    yA += yLissajousA * Mathf.Sin ((lissajousASwaySpeed / 2) * Time.time);
    xA += xLissajousA * Mathf.Sin (lissajousASwaySpeed * Time.time + ((Mathf.PI + Mathf.PI + Mathf.PI) / 4));
只需要将速度除以2,而不是乘以。Mathf.PI加法似乎是正确的

然而,x和y值是相反的。我会试着把它们修好