[Away3D 3.6] weird camera problem, this should be simple

12 views
Skip to first unread message

Stephen Hopkins

unread,
Mar 17, 2011, 10:17:40 PM3/17/11
to Away3D.dev
I have created a view3D like so

view = new View3D({x: w / 2, y: h / 2});
camera= view.camera;
camera.x = 0;
camera.y = 500;
camera.z = 0;
camera.lookAt(new Vector3D(0, 0, 0));
camera.update();
view.scene.addChild(new Cube({width: 50, height: 50, depth: 50}));
addChild(view);

i also have a render loop that just calls view.render()

Now the weird part, the cube only appears if I do not set the camera.z
value to 0

camera.z = 1, cube appears
//camera.z = 0, cube appears, z is -1000 if I trace it

I am utterly confused. All I want is to position the camera above the
cube, and the camera to look at it from a top down view.
I haven't worked in Away3D for quite a while, (my projects used
Number3D), is there any change that I don't know about?

Thanks

ragaes

unread,
Mar 18, 2011, 3:49:02 AM3/18/11
to Away3D.dev
Hello,

This is weird! I'm having the same problem!

I was getting mad until I read your post... If you set the z
coordinate a value different from 0, it works.

Also if you set the orthografic lens some things won't work, for
example wireframe objects made of Lines (GridPlane i.e.), which makes
the application crash.

Regards

xcx

unread,
Mar 18, 2011, 7:15:32 AM3/18/11
to Away3D.dev
Just to make sure than this is not just some initializing thing. Try
to apply your lookat in render loop.

Stephen Hopkins

unread,
Mar 21, 2011, 10:09:34 PM3/21/11
to Away3D.dev
I've tried setting the z in the render loop, tried putting lookAt in
the render loop. Nothing seems to work other than setting z something
close to 0. To me it seems there is some bug with the lookAt code for
looking straight down. I printed the camera transform matrix and it
did not change at all and still had the default rotation after calling
lookAt.
Reply all
Reply to author
Forward
0 new messages