Here's a nice little trick that admittedly is not my own work but is a pretty big deal nonetheless: making one or more child prims of a linked object phantom while the rest remain non-phantom. If I need to explain why this is advantageous to you, it probably isn't. Anyways, the actual implementation is very simple; all you have to do is select the desired child prim (already linked to the rest of the object), make it flexi, and then make it non-flexi again. It's that easy. However, while this is the simplest method, there are a couple of factors that limit its effectiveness. The first is that should the region restart, or the item be taken to inventory and re-rezzed, the affected prims will lose their phantom status. The second is a tad more important, and you might already have spotted it: not all prim types can be turned flexi. Suffice to say, this method has its uses but is only superior in its simplicity. However, the script below combats both of these issues, and makes phantom child prims a very reliable and easy thing to produce. Let's take a look:
default {
state_entry() {
//here's where we turn the prim flexi and back
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_TYPE, PRIM_TYPE_BOX,
0, <0,1,0>, 0, <0,0,0>, <1,1,0>, <0,0,0>,
PRIM_FLEXIBLE, TRUE, 0, 0, 0, 0, 0, <0,0,0>,
PRIM_TYPE] + llGetPrimitiveParams([PRIM_TYPE]));
}
on_rez(integer s) {
//do it again when re-rezzed
llResetScript();
}
changed (integer vBitChanges){
//and again whenever the sim restarts
if (CHANGED_REGION_START & vBitChanges){
llResetScript();
}
}
collision_start(integer num_detected){
//and hell, again if something hits it, since that only occurs when non-phantom
llResetScript();
}
}
So, as you can see, this script is placed in the child prim you want to affect. Upon starting up, it rapidly changes the prim type to a flexi Box, and then immediately back to whatever it was to begin with. It is coded to avoid losing any parameters in the switch, even, so you don't end up with a funky prim afterward. Then, whenever one of three different conditions are met (re-rez, region restart, or collision), it repeats the effect. Simplicity at its finest, allowing you to bypass one of the most frustrating obstacles during building. This script can be found on the wiki (although a tad different, without the comments and an unnoticeable nanosecond slower in operation; mine uses llSetLinkPrimitiveParamsFast instead of llSetPrimitiveParams). Hopefully it, along with this article, helps you in your quest to become a better builder. That's all for now then, til' next time.
No comments:
Post a Comment