Lay down in a vehicle, How?
|
|
Jolan Nolan
wannabe
Join date: 12 Feb 2006
Posts: 243
|
06-01-2006 11:46
I'm looking through the Wiki right now on creating a poseball, for the animation code, and it's not going all that great  . I have a plane that I want a custom sitting animation instead of that 'straight-back chair' look. How do I get it to use my new animation and do I have to ask permissions (something I haven't worked with yet) ? - Jolan
|
|
Burke Prefect
Cafe Owner, Superhero
Join date: 29 Oct 2004
Posts: 2,785
|
06-01-2006 11:49
You'd animate the avatar using either the vehicle script or the pilot chair script (if seperate), a good example can be found in any freebie motorcycle, you take permissions PERMISSION_TRIGGER_ANIMATION and add llstartanimation("your_anim_here"  and llstopanimation as located in the example script your using.
|
|
Anti Antonelli
Deranged Toymaker
Join date: 25 Apr 2006
Posts: 1,091
|
06-01-2006 12:29
I just got done working through the whole custom sitting animation thing for a project I'm working on, maybe a summary from the perspective of "the new guy who just figured it out" would be helpful. First you need to give the prim a sit target, in state_entry or possibly in on_rez depending on your needs: llSitTarget(<0.0,0.0,0.01>,ZERO_ROTATION); The way you detect someone sitting in the seat is with the changed event, looking for a change of type CHANGED_LINK which is triggered by linking, unlinking, sitting or unsitting: // if there was a change changed(integer change) { // if that change involved sitting (or linking) if (change & CHANGED_LINK) { // if the avatar is present, meaning he sat down as opposed to standing up if (llAvatarOnSitTarget() != NULL_KEY) { // request permission to animate llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION); } } } When permission is granted (happens transparently, clicking "sit" automatically implies permission to be animated) the run_time_permissions event is fired: run_time_permissions(integer perm) { // see if you got the permission you requested if (perm & PERMISSION_TRIGGER_ANIMATION) { // do the animation llStartAnimation(MyCustomAnimation); } else { // insert debugging stuff here in case permissions didn't get granted for some reason } } Hope some of that helps. edit: slight correction
|
|
Burke Prefect
Cafe Owner, Superhero
Join date: 29 Oct 2004
Posts: 2,785
|
06-01-2006 12:54
/ if there was a change changed(integer change) { // if that change involved sitting (or linking) if (change & CHANGED_LINK) { // if the avatar is present, meaning he sat down as opposed to standing up if (llAvatarOnSitTarget() != NULL_KEY) { // request permission to animate llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION); } else { // when they sit up! llStopAnimation(anim); } } Little edit since stopping animations is more fun since 1.9
|
|
Anti Antonelli
Deranged Toymaker
Join date: 25 Apr 2006
Posts: 1,091
|
06-01-2006 13:23
Thanks Burke - the script I excerpted all that from has a bunch of other extraneous stuff in the ELSE cases that I yanked out for purposes of my post. For my own future reference, does failing to explicitly stop an animation have potentially bad side-effects?
|
|
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
|
06-01-2006 14:13
From: Anti Antonelli First you need to give the prim a sit target, in state_entry or possibly in on_rez depending on your needs: llSitTarget(<0.0,0.0,0.0>,ZERO_ROTATION); Anti, that's doesn't give the prim a sit target, it removes any sit targets. You need something like <0.0,0.0,0.001> to add a sit target.
|
|
Anti Antonelli
Deranged Toymaker
Join date: 25 Apr 2006
Posts: 1,091
|
06-01-2006 15:08
From: Keknehv Psaltery Anti, that's doesn't give the prim a sit target, it removes any sit targets. You need something like <0.0,0.0,0.001> to add a sit target. Thanks Keknehv, that's just an effect of me editing unnecessary specifics out of my script for the purpose of a generic example. Of course I forgot that <0.0,0.0,0.0> is something of a special case. Oops. Original post edited.
|
|
Overld Spengler
Registered User
Join date: 26 Mar 2006
Posts: 4
|
Lying down
06-01-2006 16:05
I have come across an interesting issue when I was working on a go kart. I created a pose so that the driver was lying down. The interesting thing is since the vehicle was so low to the ground, the kart would not have all the wheels on the ground. The effect was that the person was sitting normally, and where the feet would be was below the ground. This caused the kart to float above this point.
I came to the conclusion that it doesn't matter what the animation is showing, but when the object is physical it treats the center point of the object as if the user was sitting.
To get around this issue, I just have the person sit at a 45 degree angle. This way the feet of the avatar is even with their ass. The mass of the avatar is now concentrated, and it greatly improved the vehicle handling. I made a modified pose, and it looks and drives perfectly!
Want to share this with everyone.
Overld
|
|
Jolan Nolan
wannabe
Join date: 12 Feb 2006
Posts: 243
|
06-02-2006 09:11
Hey, thanks for the quick and detailed replies  . When I get this thing working, I'll give you each a free copy  . - Jolan
|