resh
04-05-2006, 10:31 AM
Im trying to convert a surface normal direction vector that i get from IntersectRayEx() into a quaternion angle for an object. The objective is to place objects on geometry so that theyre aligned with the face thats hit with IntersectRayEx()
im still new to maxscript but this is how far i got:
auto is a car and $maasto is the geometry i want the car to be placed on
and the dummy is just for testing it actually does what i want.
for o in selection do
(
maa = $Maasto
auto = o.pivot
dum = dummy()
dum.pos = auto-[0,0,10]
r = ray auto (dum.pivot-auto)
arr= (intersectRayEx maa r)
o.pos=(arr[1]).pos
o.rotation = (arr[1]).dir -- how to convert this into quat rotation of o?
)
help is greatly appreciated and gets you extra karma points.
im still new to maxscript but this is how far i got:
auto is a car and $maasto is the geometry i want the car to be placed on
and the dummy is just for testing it actually does what i want.
for o in selection do
(
maa = $Maasto
auto = o.pivot
dum = dummy()
dum.pos = auto-[0,0,10]
r = ray auto (dum.pivot-auto)
arr= (intersectRayEx maa r)
o.pos=(arr[1]).pos
o.rotation = (arr[1]).dir -- how to convert this into quat rotation of o?
)
help is greatly appreciated and gets you extra karma points.
