Difference between revisions of "User:Lum Pfohl/LSL Goodies/Snippet/Align Prim Between Two Points"
(Created page with '{| width="100%" |- |valign="top"| <div id="box"> ==Align Prim Between Two Points== <div style="padding: 0.5em"> Occasionally, I have a need to rez a prim such as a cylinder, betw...') |
|||
Line 18: | Line 18: | ||
// the 'stick' which is aligned vertically by default - sideways by<br/> | // the 'stick' which is aligned vertically by default - sideways by<br/> | ||
// 90 degrees (or PI/2)</font><br/> | // 90 degrees (or PI/2)</font><br/> | ||
<font color='blue'>rotation</font> rezRot = <font color='red'>llEuler2Rot</font>(< <font color='red'>0.0</font>, <font color='green'>PI_BY_TWO</font>, <font color='red'>0.0</font> >)<br/> | <font color='blue'>rotation</font> rezRot = <font color='red'>llEuler2Rot</font>(<<font color='red'>0.0</font>, <font color='green'>PI_BY_TWO</font>, <font color='red'>0.0</font>>)<br/> | ||
<br/> | <br/> | ||
<font color='orange'>// Get a Unit Vector that points along the space v1 -> v2</font><br/> | <font color='orange'>// Get a Unit Vector that points along the space v1 -> v2</font><br/> |
Revision as of 05:55, 21 September 2009
Align Prim Between Two PointsOccasionally, I have a need to rez a prim such as a cylinder, between two points, lined up in that direction. The math for it is ridiculously easy, but maddeningly difficult to get right. So I've documented it below (the text coloring is not standard LSL - rather it is the coloring applied by my UltraEdit text editor. For a link to a sample 'wordfile' file UltraEdit, follow this link. rez (vector v1, vector v2) { Lum Pfohl 13:53, 21 September 2009 (UTC) |
|