Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

unlinking an object

Robin Peel
Registered User
Join date: 8 Feb 2005
Posts: 163
02-22-2006 11:54
Hello,
I have an object thats temp on rez. when its rezzd, i want it to unlink and change its state to physics to it will all fall to the ground. I would think that this is something that I can do. but I don't see any way to unlink this with a script. If this is possible, can somebody point me in the right direction?
Thank you
Introvert Petunia
over 2 billion posts
Join date: 11 Sep 2004
Posts: 2,065
02-22-2006 12:27
I just did this in some testing scripts I had written. Putting temp_on_rez contents in an object can get annoying fast. Here is the idiom I used. In the object to be rezzed a one line script:
default { state_entry() { llSetRemoteScriptAccessPin(<secret number>;); }
Put that object into the contents of the parent without fear of it vanishing if you aren't quick enough. Put a script "makeTORP" in the contents of the parent:
default { state_entry() { llSetPrimitiveParams([PRIM_TEMP_ON_REZ, TRUE, PRIM_PHANTOM, TRUE]); }
And then in the parent's script:
CODE

spawnIt() {
llRezObject("thingy", pos, vel, rot, param);
}

default() {
object_rez(key k) {
llRemoteLoadScriptPin(k, "makeTORP", <secret number>, TRUE, param);
}

.....
}
The velocity in spawnIt should be zero or close, or the child may be out of range by the time the LoadScript happens; makeTORP can give a velocity if needed. This idiom is certainly not fast enough for bullet rezzing, nor may it be the most efficient, but it does work.
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
02-22-2006 12:33
If it's for personal use, you can grant the script the PERMISSION_CHANGE_LINKS and take it, then when it rezzes it will still ahve the permission. Then you can just enable physics & phantom then go llBreakAllLinks. it will either explode or fall apart.
_____________________
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
Robin Peel
Registered User
Join date: 8 Feb 2005
Posts: 163
02-22-2006 15:47
thank you both. i'm going to try them out.
Ushuaia Tokugawa
Nobody of Consequence
Join date: 22 Mar 2005
Posts: 268
02-22-2006 16:17
Instead of going through the trouble of granting permissions and delinking on rez you might consider using an unlinked set.

Create your multiprim object but do not link it together. With the Select tool shift-select all of the prims then check Physics and Temporary on rez in the Edit->Object tab. Without linking the prims together and without deselecting them choose Tools->Take Object.

Now you have one object in your inventory that is actually a set of unlinked prims and can be placed in a rezzor and rezzed with one call of llRezObject. Any velocity you apply through this call will be applied to all of the objects in the unlinked set separately.
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
02-22-2006 16:25
Strife, I tried that with something I was working on. Everything unlinked, but stayed frozen in place. If I opened up an edit window and dragged a rectangle around them (thereby selecting them) and then clicked somewhere else (thereby unselecting them), then the physics seemed to kick in and they fell to the ground. Even though the object had physics enabled (and was moving to a target) before the 'break all links' happened.

I didn't chase it much further, because it seemed like I would have to put a script into each prim to make them break apart. I tried a stop move to target right before the break links, that didn't make a difference. I could run a sensor and push each prim after I unlinked, but that's clunky. So... that's where I'm stuck at with my "exploding previously moving physical objects" experiment.

Ushuaia, your suggestion is a good one, except in my case, I need it to be a linked single object, because it's doing stuff before it explodes.