CGTalk > Software > Autodesk 3ds max > 3dsMax SDK and MaxScript
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
Thread Tools Search this Thread Display Modes
Old 03-31-2013, 06:54 PM   #1
daniel dulitzky
3d generalist and concept artist
miami, USA
Join Date: Feb 2005
Posts: 160
help with object placing code

hi im trying to write a script
to take a reference object and placing a copy of it within the bounding box of another object
and orienting it to the to a face on the object

everything looks like its working fine
but when the target object is rotated , then the object im trying to copy and place , comes out bigger .

here is a screen capture of the result

here is the code im using right now:
obj = $box002
target = $
the_move = [ -, -,target.min.z - obj.min.z]
target.EditablePoly.SetSelection #Edge #{2}
edg= (polyop.getEdgeSelection target)
verts=(polyop.getvertsusingedge target edg) as array
newdir=((v2=polyop.getvert target verts[2])-(v1=polyop.getvert target verts[1]))
p=instance obj
move p the_move
p.dir=newdir ---orient to edge
p.rotation.x_rotation = 0 --- point object up
ratios = (target.max - target.min) / (obj.max - obj.min)
the_scale = amin #(ratios.x, ratios.y,100)
scale p (the_scale * [1, 1, 1])

i would love some help with it
any suggestions will be good
Old 03-31-2013, 09:27 PM   #2
Tamyl's Avatar
Lodz, Poland
Join Date: Sep 2010
Posts: 98
Try to get the target object rotation, then rotate it to have it straight, execute your code and then rotate both objects to have the initial rotation of the target.
Old 04-01-2013, 12:52 AM   #3
daniel dulitzky
3d generalist and concept artist
miami, USA
Join Date: Feb 2005
Posts: 160
Ok , sounds a bit messy but probobly will work !
Thanks ! I'll give it a try
Old 04-01-2013, 12:52 AM   #4
CGTalk Moderation
CGTalk Forum Leader
Join Date: Sep 2003
Posts: 1,066,478
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 10:29 PM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.