Jump to content
Sign in to follow this  
rollergirlkirsty

Roller skates That roll!!!

Recommended Posts

Hi all I'm wondering if anybody could help me with this plan I love skating in SL but the drawback is when you stop pressing forward you stop dead would love a bit of realism to it as in skatges that still have a forward motion after you stop pressing it or that can roll down hills if your standing on one.    I'm guessing it's down to physics and I'm sure it's possible any help would be appreciated

Share this post


Link to post
Share on other sites

In your control event, try triggering a timer instead of triggering the sequence to stop motion directly.  Then let the timer stop you a second or so later. 

Rolling downhil spontaneously, though, is a harder one.  I doubt that you can rely on physics.  You might try using a timer to look at the difference in llGround between llGetPos() and llGetPos() + <5.0,0.0,0.0>*llGetRot() and then triggering forward motion if the difference is greater than some limiting value like 0.5 (which is a little less than a 6 degree slope).

Share this post


Link to post
Share on other sites

I'm guessing they may be too localized, but llGroundSlope and llGroundNormal are functions that might help here.

I was reminded of those while pondering the RC_GET_NORMAL option for llCastRay RC_DATA_FLAGS as a way to detect "downhill" of non-terrain surfaces (to skate down streets, sidewalks, etc.) as well as the bare ground. It returns the surface normal at the exact point of intersection -- very localized -- so maybe it would be better to use the height difference of two downward raycasts, one a few meters ahead in the direction of travel, same as the llGround difference.

Share this post


Link to post
Share on other sites

I've found you can get some interesting avatar physics if you define an attachment as a vehicle. For example, avatars float in system water if you define them as llSetVehicleType(VEHICLE_TYPE_BOAT);

 

I'm positive you can play with the various vehicle paramters to edit your avatar's friction to be a bit more slippery, though keep in mind you'll need some high-priority animations otherwise you'll be walking in place quite a bit.

  • Like 1

Share this post


Link to post
Share on other sites

Yeah, almost any of the methods that would help you get (or calculate) an instantaneous slope ahead of your av will be too localized to help much, unless you stick to skating on sidewalks or other surfaces that are flat or only change slope gently.  But of course, that's the way RL works too.  Roller skates don't work very well on bumpy pavement.

Assuming that the slope is reasonably non-bumpy, you could use one of those forward-sensing mechanisms suggested here to calculate a offset vector -- a velocity fudge factor -- that you apply to any movement that you make in the control event. So, for example, if you are scripting your skates as a vehicle your control event might look like this, in part ...

 

    control(key id, integer level, integer edge)    {        float Ground_Here = llGround(ZERO_VECTOR);        float Ground_Ahead = llGround(<5.0,0.0,0.0>*llGetRot());        float Slope = (Ground_Ahead - Ground_Here)/5.0;        if ((level & CONTROL_FWD) || (level & CONTROL_BACK))        {            if (edge & CONTROL_FWD) gxMotor = 5.0 * (1.0 - Slope) ;            if (edge & CONTROL_BACK) gxMotor = -5.0 * (1.0 - Slope);        }        else        {            if (llFabs(Slope) >=0.1)  // Don't apply until the slope is "steep enough"            {                                 gxMotor = -5.0 * Slope;            }            else            {                gxMotor = 0.0;            }        }        if ((level & CONTROL_UP) || (level & CONTROL_DOWN))        {            if (level & CONTROL_UP)            {                                    gzMotor = 2.0 * (1.0 - Slope);            }               if (level & CONTROL_DOWN)            {                gzMotor = -2.0 * (1.0 - Slope);            }        }        else        {            if (llFabs(Slope) >=0.1)  // Don't apply until the slope is "steep enough"            {                                 gzMotor = -2.0 * Slope;            }            else            {                gzMotor = 0.0;            }        }        llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <gxMotor,0.0,gzMotor>);    }

where gxMotor and gzMotor are global floats.

  • Like 1

Share this post


Link to post
Share on other sites

in your control events you can also experiment with llSetForce() .. http://wiki.secondlife.com/wiki/LlSetForce

 and llApplyImpulse(); ... http://wiki.secondlife.com/wiki/LlApplyImpulse

 

something like this for a skate HUD ....

 

 control(key id, integer held, integer edge)
    {
        
        /*  integer start = level & edge;
            integer end = ~level & edge;
            integer held = level & ~edge;
            integer untouched = ~(level | edge);
        */
        if(held & CONTROL_FWD)
       {    if(llGetAgentInfo(owner) & AGENT_WALKING)
            {   if( ! Movingtog)
                 {   CurrAnim = "Skating";
                     llStartAnimation(CurrAnim);
                      llSetForce(<1,0,0>, TRUE);
                     Movingtog = 1;                     
                  }
            }
            else
            {
            }
                
       }
         if(edge & CONTROL_FWD)                       // stopped forward move
        {  if(llGetAgentInfo(owner) & AGENT_WALKING)
             {   llStopAnimation(CurrAnim);
                 CurrAnim = "Gliding";
                 llStartAnimation(CurrAnim);
                 llSetTimerEvent(1.0);                
                  Movingtog = 0;
             }
             else                                   // moving forward
             {  llStopAnimation(CurrAnim);
                CurrAnim = "Skating";
                llStartAnimation(CurrAnim);
                llSetForce(<1,0,0>, TRUE);                
             }
        }
    }
    timer()
    {    llSetForce(<0,0,0>, TRUE);
         llSetTimerEvent(0);
        
    }

 

Share this post


Link to post
Share on other sites

you can get a demo skate HUD from SLRDA ( Second Life Roller Derby Assoc) for free,

 or a full HUD for $L25 at Thunder_Village sim. try it and see if that is the motion you seek?

 the gliding down hill is used in them, wear with any skates you have.

( you can join the SLRDA member group for free to get notices and rink locations etc. )

 

 hope this helps..

 Xiija, Babe X on the Black Eyed Betties RollerDerby team (season opener Sun,Sept 13th)

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...