help with object placing code

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 03 March 2013   #1
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.center.x - obj.center.x,target.center.y - obj.center.y,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 March 2013   #2
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 April 2013   #3
Ok , sounds a bit messy but probobly will work !
Thanks ! I'll give it a try
 
Old 04 April 2013   #4
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.
 
Thread Closed share thread



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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 05:35 AM.


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