Jump to content

Multiple poses to a boat script


Miguelito Shilova
 Share

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

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

Recommended Posts

I am working on a foilboard (it's like a surfboard) and using a basic boat script, found here ...

What I am having difficulty with is figuring out how to trigger multiple poses when the user is operating the foilboard. There is a default 'crouching' pose and three others. I have been trying to call the poses during the control event, so that when a user presses the FWD, CONTROL_LEFT or CONTROL_RIGHT, a corresponding pose is applied to the user. What I'm looking to have happen is that when the user selects 'Ride' the crouching pose is applied. When driving forward, the avi is shown standing, as well as leaning left when going left, and leaning right when going right. When no control input is given, the avi is returned to the crouching pose. I have the custom poses, but I just need help sorting out the script. 

Not sure if it's possible, but would also like to be able to adjust the SitTarget for each pose, instead of them all using the same SitTarget. 

Please let me know if you are interested in helping. Thanks!

Mig

Link to comment
Share on other sites

with foil boards, like skate boards, hover boards and surf boards, then typically we llTakeControls of all the keys available. Moving and rotating the board, playing the appropriate animations on key press combinations

there are different ways to lay out our code to do this.

i give an example p-code control event handler of a way to do this.  Hopefully there will be enough in the example to get you started

 

// globals
integer current_trick; // 0 = no trick, 1..n = trick id/number
integer current_mode;  // 0 = default rest position, 1 = board is moving


control(integer level, integer edge)
{
    integer keydown = level & edge;
    integer keypress = ~level & edge;
    integer keyup = level & ~edge;
    

    if (keydown & (CONTROL_ROT_LEFT | CONTROL_ROT_RIGHT))
    {  // both A and D are keyed down
       if (current_mode == 1)  // board is moving
       {
             ... rotate/orient board for this trick ...
          ... llStartAnimation(for this trick) ...
          current_trick = 1;
          return;
       }
    }
    if (keyup & (CONTROL_ROT_LEFT | CONTROL_ROT_RIGHT))
    {  // both A and D are keyed up
       if (current_mode == 1)  // board is moving
       {
          if (current_trick == 1)
          {      
                ... unrotate/orient board for this trick ...
             ... llStopAnimation(for this trick) ...;
             current_trick = 0;   // no trick
             return;
          }
       }
    }

   if (keydown & CONTROL_FWD)
    {
       current_mode = 1;  // board is about to move
       ... rotate/orient board for forward drive ...
       ... llStartAnimation(forward drive) ...
       return;
    }

    if (keyup & CONTROL_FWD)
    {
       current_mode = 0;  // board is about to stop
       ... unrotate/orient board from forward drive to the rest position ...
       ... llStopAnimation(forward drive) ...
       return;  
    }
    
    if (keypress & CONTROL_FWD)
    {
       if (current_mode == 1)  // board is moving
       {
          if (current_trick == 1)
          {
             ... apply forward power to board for trick 1 ...
          }
          else  // current_trick == 0 no trick
          {
             ... apply forward power for forward drive ...
          }
       }
    }

    if (keypress & CONTROL_ROT_LEFT)
    {
        if (current_mode == 1)  // board is moving
        {
           if (current_trick == 1)
           {
              .. apply left torque to the board for trick 1

           }
           else // current_trick == 0  no trick
           {
               .. apply left torque for the forward drive position
           }
        }
        else // current mode == 0 board is in the rest position
        {
               .. apply left torque for the rest position
               .. rotating/turning the board gently ...           
        }
    }
}

 

typically when the rider sits then we play the default rest animation and never stop it until the rider stands.  This way we can stop/start/play our other animations over the top of it knowing that our rider will continue to sit/stand our board in some comfort should our other animations not play/download/etc for them

  • Like 2
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1503 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...