View Full Version : Align viewport to selection normal?

04 April 2009, 03:14 PM
I was wondering if there are any scripts out there to align the viewport camera to the selection normal, i.e. so that whatever group of faces is selected, the group normal is facing straight toward the camera.

I guess this would be somewhat related to the Align to View tool from the main toolbar (only in reverse).

04 April 2009, 03:25 PM
something similar to AlignViewToFace and such?

Edit: the 'and such':

04 April 2009, 04:35 PM
Something very much like that. Will either of those scripts work with a group of faces selected rather than a single face? If no, what will I need to change in order to make it happen?

04 April 2009, 05:12 PM
nope - just a single face..

you should be able to adjust .

In fn alignViewportToFace , change if selectedFaces.count != 1 to if selectedFaces.count == 0 and maybe change the messagebox after that accordingly.
Remove the direct assignments for selectedFaceNormal and selectedFaceCenter and instead loop over the selected faces, adding each normal / center to the variable. Once done, divide by the number of selected faces so you get an average normal / center. Normalize the normal once done with that.
After that, the code 'as is' should function correctly with the new 'selected faces' bit. *crosses fingers*

CGTalk Moderation
04 April 2009, 05:12 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.