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 Tools Display Modes
  03 March 2013
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
  03 March 2013
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.
  04 April 2013
Ok , sounds a bit messy but probobly will work !
Thanks ! I'll give it a try
  04 April 2013
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

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 12:54 AM.

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