SOLVED: Equivalent to camera.zoom and camera.focus in away3d 4?

Software: Away3D 4.x

Mr Margaret Scratcher, Sr. Member
Posted: 14 September 2011 03:11 AM   Total Posts: 344

Hi there, gradually getting my project ported over from papervision, one minor problem I’ve yet to solve is that at the moment the view is distorted kind of like the opposite way to what a fisheye lense does, which in papervision I found was determined by the .zoom and .focus attributes. Just wondering how to alter the same sort of settings in away3d 4 ?

   

Mr Margaret Scratcher, Sr. Member
Posted: 14 September 2011 03:30 AM   Total Posts: 344   [ # 1 ]

Okay, got it, need to define a lense for the camera:

camera.lens = new PerspectiveLens (30); 

Where the part in brackets is the fieldOfView - larger = wideangle smile

   

Hector, Sr. Member
Posted: 12 December 2011 10:48 AM   Total Posts: 137   [ # 2 ]

Hi Mr Margaret, thanks for posting the answer.
EDIT: As this post is marked as solved, I have created new topic for my question here:
http://away3d.com/forum/viewthread/1547/

   

GameDesigner, Jr. Member
Posted: 25 February 2012 06:27 PM   Total Posts: 33   [ # 3 ]
Mr Margaret Scratcher - 14 September 2011 03:30 AM

Okay, got it, need to define a lense for the camera:

camera.lens = new PerspectiveLens (30); 

Where the part in brackets is the fieldOfView - larger = wideangle smile

Nice tip, but what about if you want tween the fov using tweenlite?

I’ve tried to modify the original class of PerspectiveLens and LensBase to do that but it isn’t working.

TweenLite.to(camera.lens, 2, { lensFov(30) });

Any idea?

   

Lucid, Member
Posted: 25 February 2012 08:52 PM   Total Posts: 93   [ # 4 ]

So, after we’ve initialized the lens - view.camera.lens = new PerspectiveLens(70) - how do we dynamically change the fov at a later point?

There is no:
view.camera.lens.fieldOfView etc..

   

Avatar
kurono, Sr. Member
Posted: 25 February 2012 10:31 PM   Total Posts: 103   [ # 5 ]

Lucid,
Try to create new “PerspectiveLens” object for your camera, if you want to manually update them in runtime:

view.camera.lens = new PerspectiveLens(the_FOV_you_want); 
   

John Brookes, Moderator
Posted: 25 February 2012 10:45 PM   Total Posts: 732   [ # 6 ]

You dont need to create one, it gets created when you create the view.

Just cast it

//eg works in renderloop
PerspectiveLens(view.camera.lens).fieldOfView +=0.01

   

Avatar
kurono, Sr. Member
Posted: 25 February 2012 10:58 PM   Total Posts: 103   [ # 7 ]

arrgh, sorry, how could I forget it… :(
(view.camera.lens as PerspectiveLens).fieldOfView = the_FOV_you_want

   

GameDesigner, Jr. Member
Posted: 01 March 2012 12:03 AM   Total Posts: 33   [ # 8 ]

You are awesome! Thanks!

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X