|
![](/i/fill.gif) |
Alberto wrote:
> Ahhh...
>
> You may try this
>
> #macro PointTo(p)
> #local Rd = vlength(p);
> #if(Rd = 0)
> #local Rotx = 0;
> #local Roty = 0;
> #else
> #local Rotx = 180*asin(p.y/Rd)/pi;
> #if(p.z = 0)
> #local Roty = 0;
> #else
> #local Roty = 180*atan2(p.x, p.z)/pi;
> #end
> #end
> rotate <Rotx, Roty, 0>
> #end
>
> Alberto
If that works then maybe this also works:
#macro PointTo(p)
#local RotVector = <0, 0, 0>;
#local Rd = vlength(p);
#if(Rd != 0)
#local RotVector = x*degrees(asin(p.y/Rd));
#if(p.z != 0)
#local RotVector = RotVector + y*degrees(atan2(p.x, p.z));
#end
#end
rotate RotVector
#end
But I haven't tested it...
Tor Olav
Post a reply to this message
|
![](/i/fill.gif) |