Difference between revisions of "FastConeSpread"
Jump to navigation
Jump to search
(New page: <lsl> // 2008, Nexii Malthus // Licensed under the Creative Commons Attribution-Share Alike 3.0 License float Spread = 15.0; default{ state_entry(){ Spread *= DEG_TO_RAD; ...) |
m (<lsl> tag to <source>) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
< | {{LSL Header}} | ||
// | |||
// | <source lang="lsl2"> | ||
// 2009, Nexii Malthus | |||
// Public Domain | |||
float Spread = 15.0; | float Spread = 15.0; | ||
Line 12: | Line 14: | ||
touch_start( integer d ){ | touch_start( integer d ){ | ||
float x = (llFrand(1)-0.5)*PI; | float x = (llFrand(1)-0.5)*PI; | ||
float y = | float y = llFrand(0.5)*Spread; | ||
rotation rSpread = <0,llSin(y),0,llCos(y)> * <llSin(x),0,0,llCos(x)>; | rotation rSpread = <0,llSin(y),0,llCos(y)> * <llSin(x),0,0,llCos(x)>; | ||
llSetRot( rSpread ); | |||
// Example with rezzing a bullet: | |||
// rSpread *= llGetRot(); | |||
// llRezObject("b",llGetPos()+llRot2Fwd(rSpread), <60,0,0>*rSpread, rSpread, 1 ); | |||
} | |||
} | |||
</source> | |||
<source lang="lsl2"> | |||
// 2008-2009, Aeron Kohime | |||
// Licensed under the Creative Commons Attribution 3.0 License | |||
// http://creativecommons.org/licenses/by/3.0/ | |||
float spread = 15.0; | |||
default{ | |||
state_entry(){ | |||
spread *= DEG_TO_RAD; | |||
} | |||
touch_start( integer d ){ | |||
float y = spread*(llFrand(1)-0.5); | |||
float z = spread*(llFrand(1)-0.5); | |||
rotation rSpread = llEuler2Rot(<0,y,z>); | |||
llSetRot( rSpread ); | llSetRot( rSpread ); | ||
} | } | ||
} | } | ||
</ | </source> |
Latest revision as of 19:18, 24 January 2015
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
// 2009, Nexii Malthus
// Public Domain
float Spread = 15.0;
default{
state_entry(){
Spread *= DEG_TO_RAD;
}
touch_start( integer d ){
float x = (llFrand(1)-0.5)*PI;
float y = llFrand(0.5)*Spread;
rotation rSpread = <0,llSin(y),0,llCos(y)> * <llSin(x),0,0,llCos(x)>;
llSetRot( rSpread );
// Example with rezzing a bullet:
// rSpread *= llGetRot();
// llRezObject("b",llGetPos()+llRot2Fwd(rSpread), <60,0,0>*rSpread, rSpread, 1 );
}
}
// 2008-2009, Aeron Kohime
// Licensed under the Creative Commons Attribution 3.0 License
// http://creativecommons.org/licenses/by/3.0/
float spread = 15.0;
default{
state_entry(){
spread *= DEG_TO_RAD;
}
touch_start( integer d ){
float y = spread*(llFrand(1)-0.5);
float z = spread*(llFrand(1)-0.5);
rotation rSpread = llEuler2Rot(<0,y,z>);
llSetRot( rSpread );
}
}