Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

click to turn physical and back again

Lefty Belvedere
Lefty Belvedere
Join date: 11 Oct 2004
Posts: 276
12-03-2005 14:57
i have a set of prims i'd like to have start arranged, click to turn physical so they fall to the floor and then rearange themselves after 60 secs.

any ideas or existing scripts?

Thanx in advance,
~Lefty
Jay Edelbrock
Registered User
Join date: 19 Feb 2005
Posts: 19
12-03-2005 15:35
click in your inventory and do a search for an item named 'domino' and you'll get a linden-made domino that falls when you hit it or touch it, and reset itself after a few seconds.
Zapoteth Zaius
Is back
Join date: 14 Feb 2004
Posts: 5,634
12-03-2005 15:36
From: Jay Edelbrock
click in your inventory and do a search for an item named 'domino' and you'll get a linden-made domino that falls when you hit it or touch it, and reset itself after a few seconds.


Well remembered!
_____________________
I have the right to remain silent. Anything I say will be misquoted and used against me.
---------------
Zapoteth Designs, Temotu (100,50)
---------------
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
12-03-2005 15:46
This should be quite easy actually, try this:

CODE
vector startPos; rotation startRot; integer physics = FALSE;

default {
touch_start(integer x) {
if (!physics) {
llSetStatus(STATUS_PHYSICS,TRUE); physics = TRUE;
llSetTimerEvent(10);
startPos = llGetPos(); startRot = llGetRot();
}
}

timer() {
llSetStatus(STATUS_PHYSICS,FALSE);
llSetTimerEvent(0);
llSetRot(startRot);
while (llGetPos() != startPos) { llSetPos(startPos); }
physics = FALSE;
}
}



That's for 10 seconds, simply change the value of llSetTimerEvent in touch_start() to the value you require. For more fun, in the timer() event you can remove the line with llSetRot(startRot) on it (or comment it out by putting // in front) so that when the block returns it will be at a different angle so could fall in a different way each time!
Upshaw Underhill
Techno-Hobbit
Join date: 13 Mar 2003
Posts: 293
12-03-2005 16:19
a suggested ammendment to that script would be to add:

CODE
while (llVecDist(llGetPos(), targetposition) > 0.001) llSetPos(targetposition);

Snipped from the llSetPos Wiki Entry
which will avoid the not just occasional infinite loop that occurs because llSetPos doesn't always get to *exactly* where you tell it to.

L8r,
UU
_____________________