# If it was you, how would you do this??(camera question)

## Recommended Posts

Farraj    152
For example: you have scene. There is 1 3D object in a spacific place. You have a Camera (in some postion) looking dirctly at the object. What would you do to figer out the distanc the camera would move along it's 'look' vector, in a way, such that the object would be filling the whole screen?? (top of the object touches the top of the screen. bottom of the object touches the bottom of the screen) and sorry for any bad english.

##### Share on other sites
smitty1276    560
To figure that out, you would have to know the object's extent along the vectors that are orthogonal to the view and to each other. In other words, your looking at the object... how far to your left, right, up, and down does that object extend.

Without knowing that, I don't know if there is much you can do. Do you have a bounding volume for the object? Even an AABB could be used to some extent to get you in the right area.

##### Share on other sites
Farraj    152
I guess I wasn't clear.

Assume that you have all the data you need. You have a 3D object, witch means you have all the data for it like vertexs, faces, face's normals, etc...

???Would you use a bounding box for this sorta problem?? you can get the max and min of the vertexs in space, but how would you get it for the camera?

##### Share on other sites
Farraj    152
Oh, and also, you have the camera's FOV and aspict ratio. I know they're important somehow, but I haven't figered that out yet.

I was hopping if this method can also help me make sure that 2 or more objects are appearing on the screen.

##### Share on other sites
Libe    126
Quote:
 Original post by FarrajFor example: you have scene. There is 1 3D object in a spacific place. You have a Camera (in some postion) looking dirctly at the object.What would you do to figer out the distanc the camera would move along it's 'look' vector, in a way, such that the object would be filling the whole screen?? (top of the object touches the top of the screen. bottom of the object touches the bottom of the screen)

Maybe this thread will give some good tips:
http://www.gamedev.net/community/forums/topic.asp?topic_id=371596

Ciao
Libe

##### Share on other sites
Farraj    152
@_@ ooooooohhhhhhhhhhhh :D

Bounding spheres!!!!!!!!! didn't think of that. Thanks Libe.

##### Share on other sites
smitty1276    560
That's actually why I asked if you had a bounding volume... I was going to suggest spheres. A bounding volume, though, won't guarantee that the whole screen is filled... it'll only get you close, as I said.

If it must FILL the screen, you will have to iterate through every vertex and project it's position onto the orthogonal vectors I mentioned before (get the x, y, and z extent in camera space) before doing the translation toward the camera.