TargetCamera3D problem in looking at an object from the top

0 views
Skip to first unread message

Miroku

unread,
Nov 8, 2010, 1:13:36 PM11/8/10
to Away3D.dev
Hi everyone,
I have this little piece of code:

board = new Board(1500,20,1500); //extends Cube
camera = new TargetCamera3D({target: board});
camera.focus = 10;
camera.zoom = 100;
camera.z = -1500;
camera.y = 500;

away.view.scene.addChild(board); //away it's my UIComponent
away.view.camera = camera;

and I get this render: http://dl.dropbox.com/u/4064417/away3dboard.png

When the code is like this:

board = new Board(1500,20,1500); //extends Cube
camera = new TargetCamera3D({target: board});
camera.focus = 10;
camera.zoom = 100;
camera.z = 0;
camera.y = 500;

away.view.scene.addChild(board); //away it's my UIComponent
away.view.camera = camera;

I get this render: http://dl.dropbox.com/u/4064417/away3dtop.png

Instead, when it's like this:

board = new Board(1500,20,1500); //extends Cube
camera = new TargetCamera3D({target: board});
camera.focus = 10;
camera.zoom = 100;
camera.z = 0;
camera.y = 10;

away.view.scene.addChild(board); //away it's my UIComponent
away.view.camera = camera;

I get this: http://dl.dropbox.com/u/4064417/away3dtop2.jpg

Why this behaviour? It seems that the camera does not rotate itself to
look at the target object....
How can I solve it?

Miroku

unread,
Nov 14, 2010, 5:56:54 PM11/14/10
to Away3D.dev
No one can help me?

Hjupter Cerrud

unread,
Nov 14, 2010, 8:41:40 PM11/14/10
to away3...@googlegroups.com
Do you want something like this? http://www.veritasdigitalstudios.com/Nintendo/dice/06/ im using this camera code

camera = new HoverCamera3D();
camera.distance = 200
camera.panAngle = 0; 
camera.tiltAngle = 89; <---- try with this, i used 89 cuz on 90 does not show anything


Sorry for my english :P

Darcey Lloyd

unread,
Nov 15, 2010, 3:04:01 AM11/15/10
to away3...@googlegroups.com
Article with TargetCamera3D targeting mouse selected object:


Article with TargetCamera3D following mouse selected object:


So between those two articles you have TargetCamera3D targeting and positioning.



From the top of my head I would write something like this and then adjust...

// Away3D setup etc
camera = TargetCamera3D();

sphere = new Sphere();
//sphere position bottom at y 0
sphere.x = 0;
sphere.y = 0;
sphere.z = 0;
scene.addChild(sphere);

// Camera position top at y 1000
camera.x = 0;
camera.y = 1000;
camera.z = 0;

// Targeting
camera.target = sphere;
//or
camera.lookat = new Vector3D(0,0,0);


// Rotations
camera.rotationX = 0;
camera.rotationY = 0;
camera.rotationZ = 0;

Miroku

unread,
Nov 15, 2010, 4:02:45 AM11/15/10
to Away3D.dev
Ehi thank you,
In the end I solved it myself using this piece of code:

camera = new TargetCamera3D({target: board});
camera.lens = new OrthogonalLens();
camera.focus = 10;
camera.zoom = 100;
camera.y = 1000;
camera.pitch(90);

The orthogonal lense is there 'cause I needed to move objects and see
their position without perspective.
I needed this camera just to do this so if it's not good coding
matters little =)

Thank you again ;)

On 15 Nov, 09:04, Darcey Lloyd <darcey.ll...@gmail.com> wrote:
> *Article with TargetCamera3D targeting mouse selected object:*http://www.allforthecode.co.uk/aftc/forum/user/modules/forum/article....
>
> *Article with TargetCamera3D following mouse selected object:*http://www.allforthecode.co.uk/aftc/forum/user/modules/forum/article....
> >http://www.veritasdigitalstudios.com/Nintendo/dice/06/im using this
> > camera code
>
> > camera = new HoverCamera3D();
> > camera.distance = 200
> > camera.panAngle = 0;
> > camera.tiltAngle = 89; <---- try with this, i used 89 cuz on 90 does not
> > show anything
>
> > Sorry for my english :P
>
Reply all
Reply to author
Forward
0 new messages