suriyun-production / mmorpg-kit-docs

This is document for MMORPG KIT project (https://www.assetstore.unity3d.com/#!/content/110188?aid=1100lGeN)
https://suriyun-production.github.io/mmorpg-kit-docs
49 stars 11 forks source link

Question about PlayCustomAnimation #2427

Open darkkriteus opened 4 months ago

darkkriteus commented 4 months ago

Good evening, I use custom animations a lot to execute certain movements in my game, but I have a question as to how I can correctly call a CustomAnimation in a loop, as it is only executed once even though it is in a loop.

Here in PlayableCharacterModel in public void PlayCustomAnimation(int id), I noticed that no parameter is passed if the animation is in a loop ss1

however, even adding a true parameter if it is a certain animation[id], the animation is executed in a loop, but it is not overlaid by other animations, only if another CustomAnimation is executed

would this be a bug? or how should I do it correctly to work in a loop

insthync commented 4 months ago

Which loop?

darkkriteus commented 4 months ago

I want to call a customAnimation in a loop, but it never plays in a loop

insthync commented 4 months ago

How did you call it?

darkkriteus commented 4 months ago

the movements I modify BuiltIn3dMovementfunctions and call Entity.PlayCustomAnimation(id)

I need to run a customAnimation in a loop, but even though the "loop" animation is selected, it does not remain

insthync commented 4 months ago

Is the animation playing should being synced to other clients?

insthync commented 4 months ago

In a loop you mean to play animation looply?

insthync commented 4 months ago

I can misunderstand if you keep telling me that you want to play in a loop, because:

// This is loop (for...loop)
for (int i = 0; i < 10; ++i)
{
   // This is play in loop
   Play();
}
darkkriteus commented 4 months ago

sorry for the misunderstanding 🤣, the loop I mean would be an animation time loop

Screenshot_20240309-074623

even the animation marked in a loop, it is executed only once

insthync commented 4 months ago

Yep, it is not use Unity's animator component to play animation, so that setting won't work

darkkriteus commented 4 months ago

That's why I sent the image up there,It does not send any parameters if the animation is to be looped So I tried sending a true argument just to test, so it works, but the animation is only overlaid by another customAnimation, I don't know if you understand what I mean.

image

Behavior.PlayAction is always called as loop = false

darkkriteus commented 4 months ago

I thought about doing something like if (id == 5) { Behavior.PlayAction(customAnimations[5], 1f, loop = true, actionId: _latestCustomActionId); } else Behavior.PlayAction(customAnimations[id], actionId: _latestCustomActionId);

insthync commented 4 months ago

Enough, don't do anything, just wait for me to add new settings for custom movements, that is all you can do. Even it is currently having many settings but it is not enough, custom animation was made for emotion animation playing, that is it.

darkkriteus commented 4 months ago

OK, thanks for the help

insthync commented 2 months ago

How are you going to use this? why custom movement animation is needed for your game?

darkkriteus commented 2 months ago

I used it to create additional movements for my game, then it was easy to use customAnimation

AlcidesJunior123 commented 1 month ago

I had this problem, I made a script to try to get custom animations when pressing a certain key, I'm still trying to finalize it and add details. The animation loops are still a bit messy. I'm also waiting for something like that.

https://github.com/suriyun-production/mmorpg-kit-docs/assets/139077085/eb55b3c3-e6d2-4d5e-b7cd-8b8141ccd29a

The animations are looping, but at the end of the animation time, before restarting the animation, it tries to call the animation Idle. I'm working to avoid this only, after I think it should work. I think that's what you might need too. I showed it here for further clarification.