Forum Groups
  All forums
    Help & Feedback
      Questions
      Work in progress
      Finished Art
      Non-Max related
    Community
      Offtopic
      News
    Hardware
    Photography


Featured Threads
  inspiration alert!!!
(36 replies)
  Indespensible MaxScripts, Plugins and 3rd Party Tools
(37 replies)
  The allmighty FREE Resources Thread !
(17 replies)
  spam alert!!!
(4886 replies)
  Maxforums member photo gallery index
(114 replies)
  Maxforums Member Tutorials
(89 replies)
  three cheers to maxforums...
(240 replies)
  101 Things you didnt know in Max...
(198 replies)
  A Face tutorial from MDB101 :D
(95 replies)
  Maxforums.org Members Gallery
(516 replies)
  SON OF POST YOURSELF
(637 replies)
  Dub's Maxscript Tutorial Index
(119 replies)

Maxunderground news unavailable

Script help - bug when using $.pos = [0,0,0] with groups
show user profile  dvaillancourt@forgefx.com
The bug is that the $.pos = [0,0,0] command doesn't work when the object selected is a group. The only work around I could find was to first open the group, then select the group without selecting the geometry within the group.
Anyone have any ideas on how to get $.pos = [0,0,0] for a grouped object without having to open the group?

read 430 times
4/28/2008 10:45:53 AM (last edit: 4/28/2008 10:45:53 AM)
show user profile  Toen
This should work. I wasn't sure how you were going to be making selections of things so what it does is check if there is something selected first, if there is then check to see if multiple items are selected or not. If multiple items are selected then it checks to see if they are part of a group or not, if so it handles it as a group, if not then as a selection of multiple nodes that aren't grouped. If only one time is selected then it works as before.

"[$.pos.x,$.pos.y,0.0]" and "[groupHead.pos.x,groupHead.pos.y,0.0]" can be changed to to "[0,0,0]" to zero all the values out.



if ($!=undefined and $selection.count>1) then (
if (isGroupMember $[1]) then (--selection of Grouped objects
groupHead=undefined-- will hold head object of Group
for obj in $ while groupHead==undefined do (--Search for/Get Group head object
if (isGrouphead obj) then (groupHead=obj)
)
--Move Group pivot point to local minimum z value of Group bounding box
groupHead.pivot.z=$.min.z
--Move Group to 0.0 Z position in world while keeping X/Y values the same
groupHead.pos=[groupHead.pos.x,groupHead.pos.y,0.0]
) else (--selection of non-grouped objects
for obj in $ do (
--Move selected object(s) pivot to local minimum z value of it's bounding box
obj.pivot.z=obj.min.z
--Move selected object(s) to 0.0 Z position in world while keeping X/Y values the same
obj.pos=[obj.pos.x,obj.pos.y,0.0]
)
)
) else (--selection of a single obj
--Move selected obj pivot to local minimum z value of it's bounding box
$.pivot.z=$.min.z
--Move selected obj to 0.0 Z position in world while keeping X/Y values the same
$.pos=[$.pos.x,$.pos.y,0.0]
)
read 401 times
4/28/2008 1:42:44 PM (last edit: 4/28/2008 1:44:20 PM)
#Maxforums IRC
Open chat window


Support Maxforums.org