Juntalis Drago
Registered User
Join date: 17 Aug 2004
Posts: 20
|
08-19-2004 10:02
Excuse me if this code is a bit basic and messy. I also don't quite know if this has been done before but regardless.. Here it is. // Orbitting around a single point with cos and sin. // Made by Juntalis vector VECTOR_ORIGIN = <0, 0, 0>; float pi = 3.1415926535897932384626433832795; integer int_angle = 0;
default { state_entry() { llSay(0, "Hello, Avatar!"); }
touch_start(integer total_number) { VECTOR_ORIGIN = llGetPos(); llSetTimerEvent(0.1); } timer() { vector VECTOR_POSITION = <0, 0, 0>; VECTOR_POSITION.x = 5 * llCos((int_angle * pi) / 180) + VECTOR_ORIGIN.x; VECTOR_POSITION.y = 5 * llSin((int_angle * pi) / 180) + VECTOR_ORIGIN.y; VECTOR_POSITION.z = xyz_position.z; llSetPos(VECTOR_POSITION); int_angle = int_angle + 1; } }
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
08-21-2004 02:57
you are doing alot of extra work you don't have to // Orbitting around a single point with cos and sin. // Made by Juntalis // Cleaned & Hacked by Strife Onizuka vector VECTOR_ORIGIN; float angle; float radius = 5; float increment = 1;
default { touch_start(integer total_number) { VECTOR_ORIGIN = llGetPos(); llSetTimerEvent(0.1); } timer() { llSetPos( <llCos(angle * DEG_TO_RAD), llSin(angle * DEG_TO_RAD), 0> * radius + VECTOR_ORIGIN ); angle += increment; } }
comment: this should run haven't checked it
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|
Hawk Statosky
Camouflage tourist
Join date: 11 Nov 2003
Posts: 175
|
08-22-2004 14:34
And an small alternative, using LSL datatypes and shortcuts... // Orbitting around a single point with cos and sin. // Made by Juntalis // Cleaned & Hacked by Strife Onizuka // Alternative solution using LSL-native datatypes by Hawk Statosky vector VECTOR_ORIGIN; float angle; float radius = 5; float increment = 10;
default { touch_start(integer total_number) { VECTOR_ORIGIN = llGetPos(); llSetTimerEvent(0.1); } timer() { llSetPos(<radius,0,0>*llEuler2Rot(<0,0,angle>*DEG_TO_RAD) + VECTOR_ORIGIN); angle += increment; } } Putting a vector*rotation segment in your code does the rotation work for you.
_____________________
This .sig has been cancelled due to lack of interest.
|
Nightspy Rebus
Scripter Bum
Join date: 17 Jun 2004
Posts: 45
|
a nicer alternative to that
10-10-2004 05:48
float d=5; //radius vector pos; float x=0; vector thrust; integer n; default { state_entry() { llSetBuoyancy(1.0); llSetTimerEvent(0.1); pos=llGetPos(); llSetStatus(STATUS_PHANTOM , TRUE); llSetStatus(STATUS_PHYSICS , TRUE); }
timer() { x+=0.1; thrust=<llCos(x)*d,llSin(x)*d,0>; llMoveToTarget(pos+thrust,0.2); }
}
|
DrDoom Obviate
Registered User
Join date: 19 Nov 2006
Posts: 2
|
Question about this script
11-29-2006 13:03
I have a question about this script. I have a flexi tail that I made, that I want to wag back and forth at the point it is attached to me, on the z axis. Will one of these scripts do that?
|