Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Driver Animation in Vehicle

Pazzo Pestana
Registered User
Join date: 17 Sep 2006
Posts: 39
01-23-2010 17:24
How does one install a driving animation in a vehicle? one that would override the SitTarget default. I've used the Boomslang airship script and an "airship sit" script that goes in the steering wheel prim and it works fine but I can't duplicate it in my boat using "Simple Boat Script V1.0". In the Boomslang script, there is no "SitTarget" call ...

I've made a cool animation for the skipper and would like it to work.

Thanks!
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
01-23-2010 20:05
I think you misunderstand what llSitTarget() does. The sit target is a prim property, same as colour or texture, but it can only be set by script (like hovertext). While you need it to play animations, for reasons I will come to in a minute, it's not specific to a particular animation -- all it does is specify the offset from the prim where an animation should put you.


The reason you need it to play an anim is that you can't detect when someone's sitting on the prim unless a sit target has been set. A basic example -- and your script is going to be considerably more complicated because it's a vehicle -- would be something like this:
CODE
string animation = "driving anim";

integer animation_perms;

default {

state_entry() {

llSitTarget(<0.0.0.0,0.25>,ZERO_ROTATION); // note you can't have the vector at <0.0,0.0,0.0>

}

changed(integer change) {

if(change&CHANGED_LINK){
if(llAvatarOnSitTarget()!=NULL_KEY) {//this means someone is sitting on me, so
llRequestPermissions(llAvatarOnSitTarget(),PERMISSION_TRIGGER_ANIMATION);//this is automatially granted when someone sits but you still have to ask
}
else{ // someone must have got off
if(animation_perms){ // we should have it, but it doesn't hurt to check
llStopAnimation(animation);
animations_perms=FALSE;
}
}
}

}

run_time_permissions(integer perm) { // we've been granted the permissions
if(perm&PERMISSION_TRIGGER_ANIMATION){
animation_perms = TRUE;
llStopAnimation("sit"); //stop the default sit anim
llStartAnimation(animation);
}
}


}


In a vehicle script there's going to be lots more happening in the changed and run_time_permission events. Certainly you're also going to be asking for PERMISSION_TAKE_CONTROLS (i.e. respond to the driver's keyboard inputs) and also probably changing the vehicle parameters because you're starting and stopping the engine. You might even be testing to see whoever's trying to drive it is the owner or not.

But somewhere in the run_time_permissions event you're going to be starting an animation for the driver. If it says llStartAnimation("pilot animation";); (with quote marks), that's the name of the anim it's to play, so just replace it with the name of your anim. If, however, it says llStartAnimation(some_animation_name); (without quote marks), that means the animation has been set as a global variable at the top of the script, so you need to look up there for something that says string some_animation_name = "pilot anim"; and change the "pilot anim" for the name of your anim.

If it doesn't specify a value there, and just says, string some_animation_name; check in state_entry. If you find something there saying, some_animation_name = llGetInventoryName(INVENTORY_ANIMATION,0); that means it knows to use whatever animation you put in the prim.

I hope this gives you some help finding whatever you need to alter to play your own animation. I would be very surprised if there's not a sit target somewhere specified in your Boomslang airship, and I suspect you may be looking in the wrong place.

The stuff you're interested in will almost certainly be in the script in the vehicle's root prim that controls the vehicle's motion.
Pazzo Pestana
Registered User
Join date: 17 Sep 2006
Posts: 39
My deepest thanks ...
01-24-2010 02:28
for the time and patience you took to make the concept crystal clear to me! I do believe that with your expert guidance I'll be able to accomplish my goal!

thanks, again!