1 Reply Latest reply on Jul 25, 2006 3:33 AM by _lw

# different way of ratating the camera

Hi,
considering using the rotate command can give out odd resultts, I am trying a different way of rotating my camera. basically I want my camera to rotate just like how a camera rotates in a 3d application. I took a look at a different appreoach by looking at a behaviour script that the chromeLib uses. The chromeLib behaviour I am referring to is called rotating target camera. Now, from what I can see, its method is controled by the left and right arrow keys, and its calculation is done by using triginometry. In addition, the script only causes the camera to appear like it is rotating in the z direction. So I took its formulay and I thought I could switch the rotating axis from z to y so that the camera would rotate on the y axis. In other words, instead of this....

on exitFrame me

set x = (cos(pVar) * pDistance)
set y = (sin(pVar) * pDistance)

sprite(spriteNum).camera.transform.position = vector(x, y, pModel.worldPosition.z + pPlunge)
sprite(spriteNum).camera.pointAt(pModel.worldPosition, vector(0,0,1))
go to the frame

end

I did this....

on exitFrame me

set x = (cos(pVar) * pDistance)
set z = (sin(pVar) * pDistance)

sprite(spriteNum).camera.transform.position = vector(x, pModel.worldPosition.y, z)
sprite(spriteNum).camera.pointAt(pModel.worldPosition, vector(0,1,0))
go to the frame

end

however, when I did this, my camera just flew all over the place. So how could I get this to work so that the camera could appear like it is rotating off its y axis?
• ###### 1. Re: different way of ratating the camera
>basically I want my camera to rotate just like how a camera rotates in a 3d application

can you explain this a little bit more detailed?

regards!