Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Multi Wings - Help reduce Lag?

Haplo Voss
Registered User
Join date: 18 Nov 2006
Posts: 137
07-27-2009 22:54
Greetings all, long time no see :)

Ok so pretty easy Idea, but I'm losing my logic skills on figuring out the best way to attack this...

4 wings, need to flap simultaneously. I am using the following script for rotation -

CODE

// This is Prim number 13 !!
integer switch = TRUE;
integer gIntSwing = -20;
rotation gRotSwing;
default
{
state_entry()
{
gRotSwing = llEuler2Rot( < 0.0, (float)gIntSwing * DEG_TO_RAD, 0.0 > );
}
touch_start(integer num)
{
if (switch == TRUE)
{
llSetTimerEvent(.2);
switch = FALSE;
llOwnerSay("Timer Triggered...");
}
else if (switch == FALSE)
{
llSetTimerEvent(0);
switch = TRUE;
llOwnerSay("Timer Stopped...");
}
}
timer()
{
llSetLocalRot( (gRotSwing = (ZERO_ROTATION / gRotSwing)) * llGetLocalRot() );
}
}


Obviously simple, and for testing purposes I just have it as a touch script for now while I got it setup... they are all linked to the main pet I am making. Link Message goes out to each prim and says "flap" - ok so if each of these wings has a TIMER in it, along with the root LISTENER that sits and waits for HUD commands - this is getting pretty laggy is it not?

I'm trying to think of other ways to send start stop commands with a single timer controlling all 4 of them, or something that could eliminate the need for timers in each individual wing... it would be nice if I could get them to go faster of course, but hey - it is SL and I don't want to create something that is going to become known for sim crashing!! Anyway I can't come up with anything... am I just stuck? Or am I missing an easy solution like usual ;)

Thanks all and have a good one.

-Hap
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
07-28-2009 00:30
I spy with my lil eye... some of my code being recycled =)

in the timer, send a linked message to the link set, use a self switching variable inside of that timer like (flap = !flap)

in the rotation scripts you can have either
if (recieved_value){
llSetLocalRot( gRotSwing * llGetLocalRot() );
}else{
llSetLocalRot( (ZERO_ROTATION / gRotSwing) * llGetLocalRot() );
}

or just
llSetLocalRot( < gRotSwing.x, gRotSwing.y, gRotSwing.z, (gRotSwing.s * (1|-recieved_value)) > * llGetLocalRot() );

the methods for getting faster triggers requires a lot more effort, two scripts for the "timer" and multiples for each wing part.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Haplo Voss
Registered User
Join date: 18 Nov 2006
Posts: 137
07-28-2009 00:57
Indeed you see correctly ;) I have used that method for as long as I can remember just starting out in scripting in LSL - in fact I would say you have been one of the largest contributors to my learning in SL so while I'm on that topic - a HUGE thanks to you Void.

Also, on the current topic. Thank you for the solution... it is rather obvious now. It always helps to take a step back and quit banging your head against the wall for a few minutes and have dinner. LOL I already have a timer running for the follow script I've written so it will be easy to insert the link message within the main script.

Which takes me back to you again... I wrote this follower script to be cross compatible with OpenSim for some friends, therefore it is not physical. I had to figure out how to modify rotations and positions as llLookAt does not work over there. I had to dig back through some of my older stoof - which I learned from you ;) to get it all working.

Thank you again for all the support and outright problem solving you provide for everyone in the forums. Especially yours truly! hehe

Take care,
- Hap
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
07-28-2009 09:54
::looks around cautiously:: am I being set up?

seriously though, yw, and I'm glad it helps =)
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Celty Westwick
Registered User
Join date: 24 Jun 2006
Posts: 145
07-29-2009 18:41
Void and Jesse are my heroes:)