locvio Posted July 11, 2014 Share Posted July 11, 2014 Need to procedurally (via script) fit a camera (frame it up on) a bounding box of an object. Wondering if there are any examples out there.. thanks a lot!! alex Quote Link to comment Share on other sites More sharing options...
locvio Posted July 11, 2014 Author Share Posted July 11, 2014 this would be an orthographic camera, most likely.. so its a matter of controlling ortho width.. Quote Link to comment Share on other sites More sharing options...
pezetko Posted July 11, 2014 Share Posted July 11, 2014 It's quite simple.First zero your camera positions. Then copy position of object you want to frame to camera position. Then move camera a little back along it's local axis (so it doesn't clip the rendered image). It's aligned now.Then compute size (diameter) of bounding sphere of the object and put that diameter into Ortho Width. So it's zoomed correctly.I suppose that you have orientation and resolution you want to keep on camera. Quote Link to comment Share on other sites More sharing options...
locvio Posted July 11, 2014 Author Share Posted July 11, 2014 ah true. ortho makes things much simpler.. thank you! 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.