Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Making a seesaw

Surrealist Seesaw
Registered User
Join date: 17 Aug 2007
Posts: 65
11-27-2007 19:26
Hi all - I'd like to make a very simple seesaw but don't know the first thing about scripting yet. Does anyone know where I might get such a script? I'm thinking of the most basic of seesaws - a plank on a log, that kind of thing! Thanks in anticipation
Lightwave Valkyrie
Registered User
Join date: 30 Jan 2004
Posts: 666
11-28-2007 17:50
well im sure ya could find one but to make one theres lots of ways, i would get poseballs for sit on each end and make a script that waits for link messages from both sits then use
setrot in steps on a timer.
_____________________
L$ is the root of all evil
videos work! thanks SL :)
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
11-28-2007 19:25
you could try to have a board with 2 poseballs on the main prim, have the board go up and down by local rotation from the main prim, but that may be alittle to advance for you atm, there are a few ways to acculy do it, just have to research on wiki about roatations


wiki.secondlife.com go there and that is all you need to start learning about scripting
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
11-28-2007 22:05
3 prims (to take advantage of the extra sitPos)
1 do nothing log prim
2 halfcut plank prims (one for each side)

place halfcut planks cut to cut over the log
script in log sends out message
script in each plank (which set the sit pos to the end) recieves message, and rotates

//-- rotation snippet
rotation vRotSeeSaw;
//-- make deg negative in on plank positive in the other
vRotSeeSaw = llEuler2Rot( <insert_deg, .0, .0> * DEG_TO_RAD );

//-- insde link_message handler
vRotSeeSaw.s *= -1;
llSetLocalRot( vRotSeeSaw * llGetLocalRot );
_____________________
|
| . "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...
| -
Waterstar Eilde
Registered User
Join date: 12 May 2007
Posts: 404
11-29-2007 08:42
Thank you all for your suggestions and help, and thanks especially to you, Void, for such a generous answer. :)
AdorableAnn Ansar
Registered User
Join date: 29 Oct 2008
Posts: 1
:-(
10-29-2008 23:48
From: Void Singer
3 prims (to take advantage of the extra sitPos)
1 do nothing log prim
2 halfcut plank prims (one for each side)

place halfcut planks cut to cut over the log
script in log sends out message
script in each plank (which set the sit pos to the end) recieves message, and rotates

//-- rotation snippet
rotation vRotSeeSaw;
//-- make deg negative in on plank positive in the other
vRotSeeSaw = llEuler2Rot( <insert_deg, .0, .0> * DEG_TO_RAD );

//-- insde link_message handler
vRotSeeSaw.s *= -1;
llSetLocalRot( vRotSeeSaw * llGetLocalRot );




Above Script doesnt work
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
10-30-2008 01:12
that's 'cause it's not a script, it's a script fragment... just part of what goes into the script

there are also other ways to do this, for example 2 objects ( a pivot, and the board object ) and rotate the center of the board object (should still be at least 2 prims to get the free sit positions). needing only one script to detect 2 sitting avs and start cycling through a rotation change

make sure your root prim is centered to the pivot point (either an extra prim, or a half cut suggested above) and have the board tilted down 6deg on one end (eg up 6 on the other end)

CODE

float gFltDegrees = 12;
integer gIntPrimCount;
integer gIntAvatars;
rotation gRotDegrees;

default(){
state_entry();
gIntPrimCount = llGetObjectPrimCount( llGetKey() );
gRotDegrees = llEuler2Rot( <gFltDegrees, 0.0, 0.0> * DEG_TO_RAD );
}

changed( vBitChanges ){
if (vBitChanges & PRIM_NUMBER){
gIntAvatars = llGetNumberOfPrims() - gIntPrimCount;
if (2 == gIntAvatars){
llSetTimerEvent( 1.0 );
}
}
}

timer(){
gRotDegrees *= -1;
if (2 = gIntAvatars){
llSetRot( gRotDegrees * llGetRot() );
}else{
llSetTimerEvent( 0.0 );
}
}
}


that's the simplified version, probably pretty choppy, I'd add in multiple set rots at a fraction of the degrees
_____________________
|
| . "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...
| -