- Home /
Zooming camera to child objects of .obj model
I have a .obj model which has a hierarchy: many sub-objects that compose it. When in the scene editor, I can double-click on the appropriate hierarchy entry and the camera zooms to the sub-object.
However I've been unable to implement this in a C# script. In the inspector window, these sub-objects have a transform of (0,0,0; 0,0,0; 1,1,1) so in code I've only been able to get the parent's world position. I was planning to get the child's position and then use the lookAt() function.
Any alternatives?
Thanks.
I'm confused about your question. In script, you can access both Transform.localPosition and Transform.position. Transform.position is the position in world space, so you do have a easy target for your camera zoom. Can you post the code you are having trouble with?