PDA

View Full Version : Align viewport to selection normal?


Malkalypse
04-07-2009, 04: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).

ZeBoxx2
04-07-2009, 04:25 PM
something similar to AlignViewToFace and such?
http://www.scriptspot.com/3ds-max/alignviewtoface

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

Malkalypse
04-07-2009, 05: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?

ZeBoxx2
04-07-2009, 06:12 PM
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*

CGTalk Moderation
04-07-2009, 06: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.