Jump to content

To play 2 animations at the same time


bbrasta Boa
 Share

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

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

Recommended Posts

You won't.  You cannot usually play two animations at the same time, because they will interfere with each other.  It's only possible if the two anims do not try to animate the same part of your body at once, as in some eating or drinking anims, or simple anims for holding a pocketbook.  You won't find an off-the-shelf script for those special cases because there is a limited market for one. The anims can be activated separately, either in different scripts or in a single custom script written for a particular setting.  As Fritigern says, though, you can study the basic form of a script to control animations in the LSL wiki and use it to write your own.

Link to comment
Share on other sites

Actually... you can (have two animations playing at the same time).

You can have one animation making the arms and head perform some actions, and then you can start a second animation playing that works on the legs. Providing the two animations don't try and change positions of the same bones there won't be any contention.

If you are using Qavimator, just make sure that the parts of the skeleton that are to be worked by the second animation are not assigned any rotations or translations from the default.

ETA just read Rolig's post more carefully and I'm just re-iterating what she said after saying "you won't" Must read before posting in future.

Edited by Profaitchikenz Haiku
a D'oh moment
Link to comment
Share on other sites

You can definitely play two animations at the same time even if they animate the same bone(s)... that's the whole reason we have the animation priority system and other quirks.

Proper example: You play a full-body idle-stand animation which animates all bones of the avatar's skeleton, priority 3. Then you play a holding animation which animates the whole left arm, priority 4. Now your avatar has two overlapping animations trying to animate the same bones, but because the holding animation has higher priority, it will be the one that controls the left arm.

Common example: You play an idle-stand animation, priority 4. Then you play a holding animation, also priority 4. In this case, when both animations have the same priority, the animation that started last has control of all bones it would animate. The left arm of the idle-stand are overridden. Realistically, this isn't very practical because if the avatar moves, the idle-stand animation will eventually restart and take over the left arm because now it has started after the holding animation. (Workarounds exist, but I won't go into them right now.)

Anyway, now that the theory part is over, here's a practical example for starting two animations at the same time:

default
{
    state_entry()
    {
        llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
    }

    run_time_permissions(integer perm)
    {
        if (perm)
        {
            llStartAnimation("idle-stand");
            llStartAnimation("holding");
        }
    }
}

 

Edited by Wulfie Reanimator
  • Like 4
Link to comment
Share on other sites

Umm... Priorities. I've only ever used QAvimator to make animations, but when I upload one SL gives me the opportunity to set a priority. In-world, when playing two animations, when they clash it's the one with the highest priority that wins. (I understand that with some animation creating software you can set priorities within the animation itself, and even set a higher priority – 6, according to the SL Limits wiki page – than the maximum 4 allowed by the SL uploader.)

You just call llStartAnimation whenever you want.

The SL Limits wiki page doesn't, however, mention a maximum number of animations that can be run on a single avatar at any one time.

Edit: what Wulfie said.

Edited by KT Kingsley
Link to comment
Share on other sites

Wulfie's right.  If you're lucky and play the priorities right, you can get two anims to run without interfering with each other.  That's another special case that I overlooked.  It can be tricky, though. You can get a choppy performance sometimes if you have to restart either of the two scripts.

Link to comment
Share on other sites

1 hour ago, Wulfie Reanimator said:

Proper example: You play a full-body idle-stand animation which animates all bones of the avatar's skeleton, priority 3. Then you play a holding animation which animates the whole left arm, priority 4.

Yes. I've done that. I made a tray-carrying pose that I use with walk animations.

We could use a feature in the viewer which gives you the basic info about an animation - which joints, what priority, ease-in/ease out time, loop - the same info the creator sets on upload. Too many animations for sale are at too high a priority.

Link to comment
Share on other sites

8 hours ago, Mollymews said:

adding to the wants list

i would like to be able to change the runtime priority level of an animation. Something like

llStartPriorityAnimation(string name, integer priority)

We need animation reform first and with modular input functions(list input).

Priority isn't the only thing we need override control of.

There's also the ability to play/loop an animation by start frame, number of frames, frame speed.

Then there are things that don't exist, such as:

  • Current animation frames updated when a user or animesh object stops being an impostor.
  • Global start time references so animations are always in synch for when animations of objects/users enter/leave interest lists.
  • Being able to insert IK targets of global positions, same skeleton bone ID's or other skeleton bone ID with local pos/rot offsets and weighting.
  • Scripted "building" of animations.
  • Like 1
Link to comment
Share on other sites

13 hours ago, Wulfie Reanimator said:

You can definitely play two animations at the same time even if they animate the same bone(s)... that's the whole reason we have the animation priority system and other quirks.

Proper example: You play a full-body idle-stand animation which animates all bones of the avatar's skeleton, priority 3. Then you play a holding animation which animates the whole left arm, priority 4. Now your avatar has two overlapping animations trying to animate the same bones, but because the holding animation has higher priority, it will be the one that controls the left arm.

Common example: You play an idle-stand animation, priority 4. Then you play a holding animation, also priority 4. In this case, when both animations have the same priority, the animation that started last has control of all bones it would animate. The left arm of the idle-stand are overridden. Realistically, this isn't very practical because if the avatar moves, the idle-stand animation will eventually restart and take over the left arm because now it has started after the holding animation. (Workarounds exist, but I won't go into them right now.)

Anyway, now that the theory part is over, here's a practical example for starting two animations at the same time:


default
{
    state_entry()
    {
        llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
    }

    run_time_permissions(integer perm)
    {
        if (perm)
        {
            llStartAnimation("idle-stand");
            llStartAnimation("holding");
        }
    }
}

 

Hello.

Yes, this is the first script I tried, and the one I'm still playing with, because it doesn't work for me, I have a fingerless body animation in one file, and the finger animation in another file, I put them inside a prim, I created a new script from content, copied that code and pasted it in the script and saved it, but when you touch it it does nothing, even if I put the prim in the avatar, any suggestions?

Link to comment
Share on other sites

37 minutes ago, bbrasta Boa said:

copied that code and pasted it in the script and saved

Did you also change the animation names to match the animations you actually put into the script?

38 minutes ago, bbrasta Boa said:

but when you touch it it does nothing

It's not supposed to do anything when you click on the prim the script is in. As soon as the script starts, you should get a dialog that asks for permission to animate your avatar (if the prim is not attached to you).

If you don't get that, and no animations play, are you sure the script is set to running? You can check by opening the script and looking at the checkboxes on the bottom of the script editor.

Link to comment
Share on other sites

35 minutes ago, Wulfie Reanimator said:

Did you also change the animation names to match the animations you actually put into the script?

It's not supposed to do anything when you click on the prim the script is in. As soon as the script starts, you should get a dialog that asks for permission to animate your avatar (if the prim is not attached to you).

If you don't get that, and no animations play, are you sure the script is set to running? You can check by opening the script and looking at the checkboxes on the bottom of the script editor.

Hello.

Do the names of the two animations go after llStartAnimation and in quotes? 

Link to comment
Share on other sites

15 hours ago, Mollymews said:

i would like to be able to change the runtime priority level of an animation

Can't be done without drastically changing how animations are handled. Priorities are written to file on a joint basis and it's not a global constant. The animation engine just executes the sequence and the scripts don't intervene on the animation itself, it just send the instruction to retrieve an animation and play it. The viewer reads the data "as-is"

7 hours ago, Profaitchikenz Haiku said:

Yes, and I want to be able to turn it up to 11 sometimes

Theoretically, it can go as up as priority 9. I capped my animation exporter to the official limits from the SL wiki to comply with asset creation governance, but nothing would have actually kept me from making it possible.

7 hours ago, Lucia Nightfire said:

There's also the ability to play/loop an animation by start frame, number of frames, frame speed.

not really, start frame, total number of frames and speed is clearly stated in the animation file header in terms of seconds and a numeric value of speed, as well as the loop in and out time stamp. Changing this behavior may cause breakage of the playback. Perhaps the speed wouldn't, but i'm not confident enough to confirm. Viewer side it can be done, but then your change has to also be streamed over to all the surrounding viewers.

7 hours ago, Lucia Nightfire said:

Current animation frames updated when a user or animesh object stops being an impostor.

Fair enough

7 hours ago, Lucia Nightfire said:

Global start time references so animations are always in synch for when animations of objects/users enter/leave interest lists.

Being time embedded in the animation asset as an integer value ranging from 0 to 65536, the scaling of different length animations isn't that easy. I guess it can be done if a set of animations share the same exact length.

7 hours ago, Lucia Nightfire said:

Being able to insert IK targets of global positions, same skeleton bone ID's or other skeleton bone ID with local pos/rot offsets and weighting.

IK feature definitely is embedded in the file format but its broken. It needs reference to a collision volume bone and an offset from it. It just doesn't work. Global positions aren't going to work anyway, as animations live within the avatar controller's local space. You'd most likely find your foot/hand attempting to snap to some region coordinate so far away that Dhalsim from StreetFighter II would look stiff in comparison

7 hours ago, Lucia Nightfire said:

Scripted "building" of animations.

Theoretically that could be done, needs to find a way to tie a communication system between the script and the animation engine, but it wouldn't be as lightweight as loading a file and playing that back after a one-time read out.

 

What is definitely doable and i crave for since ages is a llPreloadAnimation as it is done with sounds, so the random blending in/out with base animations would be minimized near to zero.

27 minutes ago, bbrasta Boa said:

This is how it looks, I don't know why doesn't work..

The two animations play when you open them from inventory and click on the Play button on their window?

Edited by OptimoMaximo
little phrasing and wording correction
Link to comment
Share on other sites

8 minutes ago, Profaitchikenz Haiku said:

try amending the line to "if( perm & PERMISSION_TRIGGER_ANIMATION)"

secondly, what is this script inside? A worn attachment? Or a prim external to your avatar?

The &-comparison is redundant, because the value of perm can only be either 0 (no permissions granted) or what was requested. You only need specific checks if you have different sets of possible permission requests within the script.

It shouldn't matter where the script is, either, because they'll just get this if the script is not attached to an avatar:
00c909c27b.png

The script works perfectly fine for me, so I have no idea why it wouldn't work... Unless the parcel has scripts disabled?

Link to comment
Share on other sites

6 hours ago, OptimoMaximo said:

Can't be done without drastically changing how animations are handled. Priorities are written to file on a joint basis and it's not a global constant. The animation engine just executes the sequence and the scripts don't intervene on the animation itself, it just send the instruction to retrieve an animation and play it. The viewer reads the data "as-is"

What is definitely doable and i crave for since ages is a llPreloadAnimation

i vote for preload as well

just on the implications of being able to change animation parameters.  Yes is not a trivial thing to do

what this would require I think (and same with the things that Nova has mentioned) is that a modified animation would most likely have to become a new asset - new uiid. Same as how prims are done on the region server. Using CMT to preserve the original creators rights/intentions

Link to comment
Share on other sites

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