|
![](/i/fill.gif) |
> That comes VERY close. Actually, it works as I requested, although missing
> an implied criteria. I didn't specify it, but I need the box to maintain a
> vertical orientation, whereas your macro induces a rotation around the
> P1-P2 axis. I'm guessing this is an artifact of the Reorient_Trans
Replace Reorient_Trans with this macro and it should work (untested code,
let me know if it doesn't):
// maps the x axis to vec while keeping "sky" as up,
// doesn't work if vec is parallel to sky
#macro Reorient_Trans_Sky(vec, sky)
#local mapxto = vec;
#local mapzto = vnormalize(vcross(sky, vec));
#local mapyto = vcross(mapxto, mapzto);
matrix <
mapxto.x, mapxto.y, mapxto.z,
mapyto.x, mapyto.y, mapyto.z,
mapzto.x, mapzto.y, mapzto.z,
0,0,0
>
#end
Use it like Reorient_Trans_Sky(P2 - P1, y)
- Slime
[ http://www.slimeland.com/ ]
Post a reply to this message
|
![](/i/fill.gif) |