Aznavour Wolfe
Registered User
Join date: 19 Dec 2004
Posts: 9
|
09-29-2006 22:19
Hi. I just started working on some simple animations for a scripted attachment I'm working on, and ran into a minor problem.
I used a ZHAO to test the animations. The walk anim looks fine, but the problem is that I want to replace "walk backwards" with a totally different anim, and currently it just plays the existing one (in reverse?).
I'm sure this is something really obvious, but I can't find it. Is it a limitation of ZHAO, or do I have to set up the animation in a particular way, or what?
Thanks in advance.
|
Ishtara Rothschild
Do not expose to sunlight
Join date: 21 Apr 2006
Posts: 569
|
09-30-2006 05:52
There's a number of animation states which can be retrieved with llGetAnimation(id). Those animations are detected by a walk replacer or animation override and replaced with a custom animation. Alas, the same animation state (Walking) is returned if the avatar walks either back or forward, only turning left / right returns a different state. You can find a complete list of all animation states under http://rpgstats.com/wiki/index.php?title=LlGetAnimation
|
Aznavour Wolfe
Registered User
Join date: 19 Dec 2004
Posts: 9
|
09-30-2006 09:06
Hmm... Thanks.
You know what? I just realized what that simple thing I was overlooking was.
The attachment I'm building is planned to include a flight/hover assist script, so I can probably just call the animations directly from the control inputs of that script. *smacks forehead*
I guess I'll do that... Thanks again, I'll check that link out to see if it can be used to make things even better. (Is that site a direct mirror of the LSL wiki?)
|
Ishtara Rothschild
Do not expose to sunlight
Join date: 21 Apr 2006
Posts: 569
|
09-30-2006 14:02
Yes, as far as I know it's identical with the old, currently unavailable Scripting Wiki. Hm... listening in to the user controls is indeed an easy way to figure out the walking or flying direction. Could look like this: key owner; integer direction=1; // 1=forward, 2=backward string anim;
startup() { owner=llGetOwner(); llRequestPermissions(owner, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS); llSetTimerEvent(0.5); }
default { state_entry() { startup(); } on_rez(integer nevermind) { startup(); } // run_time_permissions event with llTakeControls and other script parts control(key id, integer down, integer new) { integer held = down & ~new; if (held & CONTROL_FWD) { direction=1; // do other stuff } else if (held & CONTROL_BACK) { direction=2; // do other stuff } // else if (held & ... } timer() { anim=llGetAnimation(owner); if (anim=="Walking") { llStopAnimation("stand"); if (direction==1) llStartAnimation("walkforward"); else llStartAnimation("walkback"); } // else if (anim=="... } } To make it more performant, you could name your two walking animations "walk1" and "walk2", to save one if...else statement in the timer event: timer() { anim=llGetAnimation(owner); if (anim=="Walking") { llStopAnimation("stand"); llStartAnimation("walk" + (string)direction); } // else if (anim=="... } }
|
Foolish Frost
Grand Technomancer
Join date: 7 Mar 2005
Posts: 1,433
|
10-01-2006 09:51
Would it not also be possible to get the avatar (or attachment) velocity with llGetVel() and use that data to see if the avatar is walking back or forth?
|