Jump to content

Make a bag attachable & rezzable


primerib1
 Share

You are about to reply to a thread that has been inactive for 471 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Okay so I'm making a bag containing items to give.

I want the bag to be both rezzable and attachable.

It's nicely sized & rotated when rezzed in world.

However when it gets attached to the HUD, it's too large. If I can reduce it to, say, 50-60% of the original size, it'll fit the screen much nicer.

So I made the following code:

on_rez(integer start_param) {
    llSleep(0.5); // Just in case it doesn't attach instantly
    llLinksetDataWrite("_attached", (string)llGetAttached());
    if ("" == llLinksetDataRead("_large")) llLinksetDataWrite("_large", "1");
    llResetScript();
}

state_entry() {
    if (($is_attached = (integer)llLinksetDataRead("_attached"))) {
        if ("1" == llLinksetDataRead("_large")) {
            llScaleByFactor(0.6);
            llLinksetDataWrite("_large", "0");
        }
        llSetLocalRot(HUD_ROT_QUAT);
    }
    else {
        if ("0" == llLinksetDataRead("_large")) {
            llScaleByFactor(1.66667);
            llLinksetDataWrite("_large", "1");
        }
        llSetLocalRot(<0, 0, 0, 1>);
    }

Works okay-ish, with a slight delay. But there is one problem:

If the bag had been attached as a HUD, then detached, then rezzed on the ground, sure it rotates to upright + return to its full size...

But because it was rezzed at 60% scale, the bag then clips the ground.

Is there a better way to achieve what I want? Preferably, not clipping the ground when it 'returns' to its full size?

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 471 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...