开发者

Actionscript 3D how to rotate around 3d coordinates

开发者 https://www.devze.com 2022-12-21 05:26 出处:网络
I wanted to write a simple 3d image rotating around the y-axis as the Image carousel. I can place all the photo around the axis but I can\'t get the main开发者_开发知识库 image facing towards the scre

I wanted to write a simple 3d image rotating around the y-axis as the Image carousel. I can place all the photo around the axis but I can't get the main开发者_开发知识库 image facing towards the screen. I mean the z-axis isn't pointing towards the screen. Instead, the z-axis is towards the top left corner.

How do i make the z-axis pointing perpendicular to the screen?


Check out the PerspectiveProjection class, set the fieldOfView to 45, and do something like this:

var pp:PerspectiveProjection = new PerspectiveProjection();
pp.projectionCenter = new Point(this.width/2, this.height/2);
pp.fieldOfView = 45;
this.transform.perspectiveProjection = pp;

The default PerspectiveProjection for the main Sprite/Application is at the top left corner, so in 3D everything will look like it's stretching to the top left. So just set it to the center of the application, and update it if anything resizes or changes.

gotoAndLearn.com has a simple Click and Zoom 3D Carousel that might help.

Let me know if that works out, Lance

0

精彩评论

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

关注公众号