Maxscript
Jump to navigation
Jump to search
3dsmax 3d to 2d
fn mapWorldToScreen pos = ( width=gw.getWinSizeX() height=gw.getWinSizeY() thePos = pos * viewport.getTM() screenOrigin = mapScreenToView [0,0] (thePos.z) [width,height] worldSize = screenOrigin*2 xAspect = width/(abs worldSize.x) yAspect = height/(abs worldSize.y) screenPos=point2 (xAspect *(thePos.x-screenOrigin.x)) (-(yAspect*(thePos.y-screenOrigin.y))) --screenPos=point2 (xAspect *(thePos.x-screenOrigin.x)) (-(yAspect*(thePos.y-screenOrigin.y))) --if (screenPos.x) < 0 then (screenPos.x=0) --if (screenPos.y) < 0 then (screenPos.y=0) screenPos.x = screenPos.x as float screenPos.y = screenPos.y as float screenPos ) p = $.pos p = mapWorldToScreen p $cam.name renderWidth