开发者

360 rotation degrees to 2d object from 3d papervision object in actionscript

开发者 https://www.devze.com 2022-12-22 10:50 出处:网络
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 camer

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 fin开发者_开发知识库ding 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.


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号