Positioning a Camera

I am trying to position a camera to take a particular view of an object using

camera.transform.translate ( vector 3, space.world)

However, when I do this it appears that camera is positioned in relation to the old camera position rather than directly in world space. I have tested this happening when I position the camera the first time - it is positioned in relation to the position set in the camera game object originally. I can get around it by calculating where I want the camera and then setting the position relative the existing position that I can get using

vector 3 posn = camera.transform.position.

Seems like a bit of a kluge. Does space.world not work with the camera? What am I missing?

Thanks for any help

Hi andycruce,

Transform.translate will always move the game object in the direction and distance of your Vector3. That’s why the new position is dependent of the old position.

“space.world” only indicates that this translation has to take place in the world’s referential, instead of being relative to the transform’s local axes.

If you want to position your object at a specific location of the world, you can simply use

camera.transform.position = new Vector3(posX, posY, posZ);