• Hm, my best guess would be that you've got somewhere a wrong setup in your animations, e.g. combatant using wrong animation setup or one of the parameter change being wrong.

    Otherwise I'd try setting up separate controllers for the different classes.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I've quintuple checked that the params are the correct in my animations setup... Dang ok.. The way I have it setup lets me reuse all the generic animations and then just have overrides for combat. I know i can use an override controller for this but the way I have it is more flexible. Anyways I will come up with a new solution here..

    The last item on my list is, even when I have auto animations disabled, whent he character is in its defend stance and gets hit, it seems to revert to normal idle. Again I have checked and rechecked my mappings and it seems like idle is being fired explicitly here..
  • Well, getting hit usually plays a damage animation, so you'll need to make sure it'll transition back to defend afterwards (e.g. using a bool parameter).

    Also, if you're setting your character type parameter with every animation, you might want to change that once (e.g. using the combatant's Spawn Game Event), or when it should change. If you only override some animations and the rest still has type 1 instead of type 2, it'll definitely get set back to 1 when one of them plays.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • So I only have 1 character type now, and I'm using override controllers for the different prefabs that use it.

    Here is a look at my setup for 'Damage' animation in both normal and defensive states:

    image

    'Get HIt' and 'Get Hit 0' each have a behaviour on them that automatically sends back to a specific state; 1 or 8, respectively.

    The script is very simple, and is inline below.



    using UnityEngine;

    public class EndStateParamSet : StateMachineBehaviour
    {

    public string paramName;
    public int paramValue;

    public bool useFinishTime = false;

    public float finishTime;

    private float startTime;

    public EndStateParamSet()
    {
    }

    public EndStateParamSet(string name, int value)
    {
    this.paramName = name;
    this.paramValue = value;
    }

    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
    startTime = Time.fixedTime;
    }

    // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
    animator.SetInteger(paramName, paramValue);
    }

    override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {

    var finishTimeSet = animator.runtimeAnimatorController.animationClips[0].length / animator.speed;
    if (useFinishTime)
    {
    finishTimeSet = finishTime;
    }

    if (Time.fixedTime - startTime >= finishTimeSet)
    {
    animator.SetInteger(paramName, paramValue);
    }
    }
    }

  • Wouldn't you also need a transition back to defend idle, either from get hit 0 or from any state?
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thats what that script does. Either on state exit, or after the animation end time it auto sets the animation state to the correct values.

    Get Hit => paramName='Action', paramValue=1
    Get HIt 0 => paramName='Action', paramValue=8
  • So I got most of this working using animation override controllers instead of the more complicated single controller with character types.

    One last issue I hm having (for now :P)...

    Even when I have auto animations disabled, when the character is in its defend stance and gets hit, it seems to revert to normal idle. I have checked and rechecked my mappings and it seems like idle is being fired explicitly here, rather than just allowing the character or event to control that.
  • Idle animation is definitely not coming from ORK if auto animations are disabled - this only happens with them enabled. I guess it's a transition in your animator controller that's returning to the idle animation?
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Ok thanks, I didnt think so but let me check some more to see if i am causing this.
  • Hmm after spending significant time on this, I am unable to figure out where the extra transition is coming from.

    Now, the auto animations I have disabled from an event node, then in a later event node i re-enable them.

    It is between these 2 discrete events that I am having the problem.

    The main configuration has them enabled by default. Is it possible that they are being re-enabled automatically by the 'get hit' event? If it sees that the default config is enabled?
  • edited October 2019
    The damage animation is still played, auto animations only handle ide/movement animations. You can disable animating damage, though. Consumable status values have an option for that :)

    I'd need a Unity test project to check things out and be able to help you.
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Hey sorry for the delay. Test project would be the same github repo as last time.

    I upgraded unity version to 2019.2.8f1
  • Hm, please send me the link again via email - there's just too many projects I get sent to keep track of everything :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Roger that :)
  • Alright - finally got to it, and here's my conclusion:

    Your Mecanim setup is bad :D

    I think the main issue is that all your different animation states hang on the same parameter (Action), i.e. defending is overridden by damage or evade animations simply because they change the parameter to something different and not return back to defending.
    Generally, it could work that way if you set up correct transitions in your defend animation states - but the next issue is that your ORK animation setup is using cross fading to play a specific state instead of relying on the parameters you've also set up. E.g. your damage animation will fade to the Get Hit state, which is a different state than the Get Hit 0 state related to the defend states ... and due to your state machine behaviours changing the parameter as well, that's where things get messy.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.