How to create a camera that always points to an object from a certain distance.

Software: Away3D 4.x

vikramarka, Newbie
Posted: 16 May 2013 09:56 AM   Total Posts: 10

Hi All,

I am new to Away3d and exploring it now. I think it is just great. I have a requirement, in which I need to create a camera, that looks at an object from top view. Now my 3d object will rotate based on accelerometer and camera should change its position so that the object appears from the top view. it means the object will always appear from the top view, no matter how it is rotated.

Any idea of how to achieve this..?

   

Bartek5186, Newbie
Posted: 16 May 2013 10:07 AM   Total Posts: 4   [ # 1 ]

camera.lookAt(obj)

camera.positionX = obj.positionX
camera.positionZ = obj.positionZ

   

vikramarka, Newbie
Posted: 16 May 2013 10:37 AM   Total Posts: 10   [ # 2 ]

Hi Bartek5186!

Thanks for the quick reply. If I set like above, wouldn’t it set the camera exactly at the object position? I would like to have it at a distance say 400 pixels above the object and the position changes accordingly upon object rotate..

   

Bartek5186, Newbie
Posted: 16 May 2013 02:06 PM   Total Posts: 4   [ # 3 ]

You can set camera.positionY = obj.y + heightOfObject + 400;

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X