Page 1 of 1

Moving Sidewalk Script Help

Posted: Tue Jan 23, 2024 11:53 am
by Koshari Mahana
.
Kimm Starr and I are looking for a moving sidewalk script that will work in bulletsim. It's the sort of sidewalk that you stand on and it moves your avatar forward (without using a 'sit' pose). She has one that was scripted for ODE but not for bulletsim. Any help would be greatly appreciated!

Here is the ODE version:

Code: Select all

// Moving Sidewalk Escalator  
// Pushes avatar when stepped on or detected within area of prim.
//
// v0.1 vegaslon plutonian (2013) working concept.
// v0.2 Lani Global (2013) added sim restart reset. 
// v0.3 Lani Global (2013) added description setting of push force. 
// v0.4 Lani Global (2013) changed to collide only instead of volume detect.

default

{
        state_entry()
    {
        float OBJECTDESC = 10; // set the default push to 10.
        llSetTextureAnim(ANIM_ON | SMOOTH | LOOP , ALL_SIDES, 1, 1, 1, 1, -0.07); // animate sliding texture.
    }
    collision(integer num_detected)
    {
        float OBJECTDESC = llGetObjectDesc(); // gets description of prim and use it as push force in z axis.
        llPushObject(llDetectedKey(0),<OBJECTDESC,0,0>, <0,0,0>, TRUE); // push on the avatar a little.
    }
     changed(integer EVENT) 
    {         
        if (EVENT & CHANGED_REGION_START) // detect if region has been restarted.
        { 
            llResetScript(); // reset the script
        }
    }
}

Re: Moving Sidewalk Script Help

Posted: Wed Jan 24, 2024 1:05 pm
by Christine Nyn
The Moving sidewalk uses a very simple method of moving - it simply pushes the avatar while they are "in collision" (touching) the walkway. Unfortunately the way that "push" works is it uses a calculated energy budget allocated to the script and that diminishes with each push. Then a pause ensues while the energy budget is topped up again. Thus you tend to get a rather jerky response.

As the collision event which is driving the "push" is continuous while the avatar is on the sidewalk it also places quite heavy demands on the region's script timings so having several such objects working simultaneously would probably not be a good idea.
The script as posted has a default value of 10.0 for the "push" but this can be overridden by putting a value in Object Description of the sidewalk prim. If the push seems a bit too heavy in Bullet sim then going to a lower number, perhaps 4.0, might allow the script to be usable.

I've passed you an alternative solution inworld that uses llKeyframedMotion() to move the avatar and is thus kinder on the region resources but requires the avatar to click on the sidewalk to initiate the transport.

Re: Moving Sidewalk Script Help

Posted: Thu Jan 25, 2024 6:42 am
by Koshari Mahana
Thank you so much for your help.
Christine Nyn wrote:
Wed Jan 24, 2024 1:05 pm
The Moving sidewalk uses a very simple method of moving - it simply pushes the avatar while they are "in collision" (touching) the walkway. Unfortunately the way that "push" works is it uses a calculated energy budget allocated to the script and that diminishes with each push. Then a pause ensues while the energy budget is topped up again. Thus you tend to get a rather jerky response.

As the collision event which is driving the "push" is continuous while the avatar is on the sidewalk it also places quite heavy demands on the region's script timings so having several such objects working simultaneously would probably not be a good idea.
The script as posted has a default value of 10.0 for the "push" but this can be overridden by putting a value in Object Description of the sidewalk prim. If the push seems a bit too heavy in Bullet sim then going to a lower number, perhaps 4.0, might allow the script to be usable.

I've passed you an alternative solution inworld that uses llKeyframedMotion() to move the avatar and is thus kinder on the region resources but requires the avatar to click on the sidewalk to initiate the transport.