Crustedink Posted November 23, 2022 Share Posted November 23, 2022 (edited) Hello, I am currently trying to build a asset turntable tool, most things are fine, but now i am looking for a way to automatically move the camera for and back in z to make sure, that the framing of the object is good (not too far away and not too close to avoid any clipping). The camera has no rotation. using the center of the bounding box of my asset as y position and the focal length is also fixed. whats the best approach to calculate the distance in z ? thank you for the help! Edited November 23, 2022 by Crustedink Quote Link to comment Share on other sites More sharing options...
tamagochy Posted November 23, 2022 Share Posted November 23, 2022 (edited) I'm using this: (max(bbox(-1,D_ZSIZE),max(bbox(-1,D_XSIZE),bbox(-1,D_YSIZE)))/2)/sin(2*atan((ch("../cam1/aperture")/2)/ch("../cam1/focal"))/2) bounding box of the render object Edited November 23, 2022 by tamagochy Quote Link to comment Share on other sites More sharing options...
Crustedink Posted November 24, 2022 Author Share Posted November 24, 2022 (edited) 21 hours ago, tamagochy said: I'm using this: (max(bbox(-1,D_ZSIZE),max(bbox(-1,D_XSIZE),bbox(-1,D_YSIZE)))/2)/sin(2*atan((ch("../cam1/aperture")/2)/ch("../cam1/focal"))/2) bounding box of the render object thanks for the reply, sorry for the silly question, but can you explain it a bit further ? so where and how are you using it ? -//edit NVM, its workign now. thank you Edited November 24, 2022 by Crustedink Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.