Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / organizing a verices array by uv coords
  RSS 2.0 ATOM  

organizing a verices array by uv coords
Rate this thread
 
60212
 
Permlink of this thread  
avatar
  • awesome
  • Posted: 21 September 2011 06:35 AM
  • Total Posts: 9
  • Joined: 04 January 2009 02:15 PM

I’m trying to make a script snap and align a point helper to the vertices of an arbitrary quad. my problem is that the winding order of the quad is inconsistent when using polyop.getvertsusingface. Is this because I’m not recognizing the pattern, or is this something that I need to find a work around for. I was thinking of trying to reorder the vertices based on their uv space, but before I jump into sorting algorithms I hoped to get some input on perhaps better solutions. feel free to point out any coding faux pas , I just started learning maxscript 3 days ago.

--sets the location quad varibles
moveToObj = $
newdir = polyop.getfacenormal $ ((polyop.getfaceselection $) as array)[1]
corners = (polyop.getvertsusingface $ ((polyop.getfaceselection $)as array)[1]) as array

--corner points. I created the linked xform beforehand
points = $ as array

for i = 1 to points.count do
(
points.pos = polyop.getvert movetoobj corners
points.dir = newdir
)

I attached a .jpg to show what I’m talking about. the left window is usually what ends up happening, the right is if I spend 5 minutes messing with the point helper array selection order (trial and error)



Attachment Attachment
Replies: 1
/img/forum/dark/default_avatar.png

nevermind, the winding order of getvertsusingface will always be unordered (don’t quote me on that though), I wrote a function that sorts the verts compared to the face center, so everything is working now.

Author: awesome

Replied: 26 September 2011 09:34 AM