|
![](/i/fill.gif) |
Yes!
// Reorient from <0,0,1> to p
#macro PointTo(p)
#if (0+p.x=0 & 0+p.y=0 & 0+p.z=0)
#local RotX=0;
#else
#local RotX=-atan2(p.y,sqrt(pow(p.x,2)+pow(p.z,2)))*180/pi;
#end
#if (0+p.x=0 & 0+p.z=0)
#local RotY=0;
#else
#local RotY=atan2(p.x,p.z)*180/pi;
#end
rotate <RotX,RotY,0>
#end
or
//reorient from vector 1 to vector 2
#macro reposition2(vec1,vec2)
#if (vlength(vec1)=0)
#render "Warning: reposition2 initial vector length is zero.\n"
#end
#if (vec1.x=0 & vec1.z=0)
#local RotY=0;
#else
#local RotY=atan2(vec1.x,vec1.z)*180/pi;
#end
#local RotX=asin((vec1.y)/vlength(vec1))*180/pi;
rotate -RotY*y
rotate RotX*x
#if (vlength(vec2)=0)
#render "Warning: reposition2 final vector length is zero.\n"
#end
#if (vec2.x=0 & vec2.z=0)
#local RotY=0;
#else
#local RotY=atan2(vec2.x,vec2.z)*180/pi;
#end
#local RotX=asin((vec2.y)/vlength(vec2))*180/pi;
rotate <-RotX,RotY,0>
#end
--
___ _______________________________________________
| \ |_ <dav### [at] faricy net> <ICQ 55354965>
|_/avid |ontaine http://www.faricy.net/~davidf/
"The only difference between me and a madman is that I'm not mad." -Dali
Post a reply to this message
|
![](/i/fill.gif) |