Jump to content

animating vehicle scripts


ChaosRaine
 Share

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

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

Recommended Posts

I am writing a vehicle script and I can get most of it to work. It takes control steers nicely and all that good stuff. I can get it to play an animation when I press forward, back, left and right, however after moving I can't get it to play an idle animation when no control buttons are being pressed. Does anybody know his to add that? I can post my script here tomorrow if you need to see it.
Link to comment
Share on other sites

I often use the control on 'Page Down' Key to set the motors to zero

Something like this:

if(level & CONTROL_DOWN){    gLinearMotor = ZERO_VECTOR;    llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, gLinearMotor);    angular_motor = ZERO_VECTOR;    llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, angular_motor);}

I hope this will help you

:smileysurprised::):smileyvery-happy:

Link to comment
Share on other sites

I'm not having trouble with the vehicles motion. I want animations to play I'm moving and a different when I'm stopped. I tried to put in timers that checked for control buttons being pressed but all I could get was a check if the button was pressed we've the last timed event, so if I hold the button down threw two timed events it would pay the idle animation again instead of the survival one.

Link to comment
Share on other sites

If you mean you want to detect, in the control event, if nothing is being pressed, try something like this, based on the Wiki example,

default{    state_entry()    {        llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS);    }    run_time_permissions(integer perm)    {        if(PERMISSION_TAKE_CONTROLS & perm)        {            llTakeControls(                            CONTROL_FWD |                            CONTROL_BACK |                            CONTROL_LEFT |                            CONTROL_RIGHT |                            CONTROL_ROT_LEFT |                            CONTROL_ROT_RIGHT |                            CONTROL_UP |                            CONTROL_DOWN |                             CONTROL_LBUTTON |                            CONTROL_ML_LBUTTON |                            0, TRUE, FALSE);                            // | 0 is for edit convenience,                            // it does not change the mask.        }    }            control(key id, integer level, integer edge)    {        integer start = level & edge;        integer end = ~level & edge;        integer held = level & ~edge;        integer untouched = ~(level | edge);        //llOwnerSay(llList2CSV([level, edge, start, end, held, untouched]));                integer playAnim = FALSE;        llSetTimerEvent(0.0);                if(end){          playAnim=TRUE;                   }                        if(untouched){                  if(playAnim){             playAnim=FALSE;             llSetTimerEvent(0.5);            return;            }        }    }        timer(){      llSetTimerEvent(0.0);      llOwnerSay("should play idle animation here");       }}

 

Link to comment
Share on other sites

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