Notifications
Clear all

[Closed] Align viewport to selection normal?

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).

3 Replies

something similar to AlignViewToFace and such?
http://www.scriptspot.com/3ds-max/alignviewtoface

Edit: the ‘and such’:
http://www.scriptspot.com/3ds-max/alignviewporttoface

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?

nope – just a single face…

you should be able to adjust http://www.scriptspot.com/3ds-max/alignviewporttoface .

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