Actionscript 中从 3d papervision 对象到 2d 对象的 360 度旋转

发布于 2024-08-25 12:03:07 字数 379 浏览 3 评论 0原文

出于某种原因,我已经为此苦苦挣扎了一段时间。

我有一个纸视觉相机,它使用键盘输入来转动,我有一个雷达,我想在相机转动时将其定向到方向。

除了将我的(相机)DisplayObject3D.rotationY 正确映射到RadarInterface.rotation 之外,我还可以正常工作。

相机(或任何 3D 对象)使用我发现很难的值: 顺时针方向:0 到 89、89 到 0、-0 到 -89、-89 到 -0 完成完整的 360 度

旋转。因此,如果我要旋转 180 度,我会从 0 度旋转到 90 度,再次回到0。

有谁知道如何将其转换为 360 度。

提前致谢。

Some reason I've been struggling with this for a while.

I have a papervision camera of which turns using keyboard input, I have a radar of which I would like to orientate to direction when the camera turns.

I have it all working apart from mapping my (camera) DisplayObject3D.rotationY to RadarInterface.rotation correctly.

The camera (or any 3d object) works with values I'm finding hard:
Clockwise: 0 to 89, 89 to 0, -0 to -89, -89 to -0 doing a complete 360.

So if I were to turn 180 degrees I'd go from 0 to 90 and back down to 0 again.

Does anyone know how to convert this to 360 degrees.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淡淡绿茶香 2024-09-01 12:03:07

我不太清楚你给出的这些数字是如何运作的。过去,由于闪光灯将 270 度更改为 -90 度或类似原因,我遇到过物体旋转不正确的旋转问题。下面的陈述多次帮助我解决这个问题;它将范围从 0 到 360 更改为 -180 到 180。

if (Math.abs (difference) > 180) {
    difference = difference > 0 ? difference - 360 : 360 + difference;
}

您是说 45 度会返回与 135 相同的值吗?

It isn't exactly clear to me how these numbers you have given would work. In the past I've had rotation problems with objects spinning incorrectly due to flash changing 270 to -90 or something like that. The statement below has help me with this a few times; it changes the range from 0 to 360 to -180 to 180.

if (Math.abs (difference) > 180) {
    difference = difference > 0 ? difference - 360 : 360 + difference;
}

Are you saying that 45 degrees would return the same value as 135?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文