Notifications
Clear all

[Closed] Align objects to an object with pivot point Orthographic view port?

Hi,
I have a project now need to align objects to an object,in a Orthographic view port,for example,there is an object names a,it’s position is [0,0,0],how can I align other’s Y position to a’s Y position(pivot point method,Orthographic view port)?
What I know is easy move objects to a new Y position directly using:

--a is the selection
--selection[1].pos=[0,0,0]
--a's Y position in Orthographic=get a's Y data in Orthographic view port
--in coordsys (inverse (getViewTM())) (move selection [0,(a's Y position in Orthographic),0])

but how can I get the a’s Y position?

4 Replies
tm = getviewtm()
p0 = target.transform * inverse tm 
p1 = source.transform * inverse tm 
sy = (p0.pos - p1.pos).y
in coordsys tm move source [0,sy,0]



where source is an object you want to align, and target is an object you want to align to

i’m probably wrong, if you are talking about Orthographic Screen Y coordinates

1 Reply
(@momo2012)
Joined: 11 months ago

Posts: 0

Hi,thanks,yes,just tested,it seemed the code need to fix.

try this

tm = inverse (getviewtm ())
tm.pos = target.transform.pos	

tmSrc = source.transform * inverse tm
tmSrc.pos.y = 0
--tmSrc.pos.z = 0 -- if you want to match depth
source.transform = tmSrc * tm