edited March 2021 in ORK Support
(currently it happens at the very end of the animation)
As different animations take a different amount of time, I would like to be able to execute the target change/status value change (e.g. subtracting HP) at a certain point in the animation. Is there any standard way to achieve that in the ability settings?

Actually, I have this ability animation event, with the Calculate step which triggers the Target Status Value change. I only wonder, how can I change when it is triggered.
image

I have normalized time of the animation set to 0.5 which I would expect, that it triggers the Calculate halfway through the animation.
image

Post edited by zatokar on
  • The Calculate step is when the ability's status changes are calculated (and visible, e.g. via flying texts), i.e. you can control when this happens via this node.

    As you already found out, the Normalized Time in animation nodes allows you to wait for a part of the animation's duration, e.g. 0.5 being 50% of the animation's play time.
    The Store Duration settings allow you to store the remaining time into a game variable and use it in Wait node (e.g. after calculation) to wait for the rest of the animation to finish.

    One thing to keep in mind when using Mecanim animations is to correctly set up the animation's duration via the Duration Type setting. Mecanim doesn't report play times back, so it's a bit more complex to do. You can either set a fixed time or find it via the animation clip's name.

    Also, on a side note, you don't have to use the Calculate node's Miss next slot for animating the target, that's happening automatically when you have Animate Target enabled. Which animation type is played depends on the Damage Type of the animation, either via it's ability type or own damage type override.
    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!
  • edited March 2021
    Thank you for an exhaustive answer.

    My mecanim animations are set up like this:
    image

    Where attack1 is also the name of the animation clip, meaning it should be able to retrieve the animation duration.

    What I am experiencing, in reality, is that even with the normalized time set to 0.5 as you can see in the above screenshot, I still get the Calculate node/step executed a after the animation has finished entirely. I have no clue why does it behave like that. Any ideas?

    Thanks a lot
    Post edited by zatokar on
  • Does the wait time change if you change the Normalized Time in the Combatant Animation node?
    It's not exactly rocket science, as it's just multiplying the animation duration (it finds based on the Mecanim animation setup in ORK) with the normalized time value ...
    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 just figured where the problem lies but I don't know how do I solve it.

    When I set low attack speed to a monster combatant, then with a normalized time 0.5 on the animation node I achieve what I want -> deal damage (resolve target change) at the time when combatants "weapon" collides with player combatant (approximately).

    When I set higher speed to a monster combatant, the animation resolves faster, but deal damage (resolve target change) comes delayed (after the animation has already finished).

    So to me, it seems like the normalized time setting in the animation node is based on default animation speed, not animation speed I set in the Base/Control > Animations > Mecanim Settings > Speed Value > Attack speed formula based on Status value.

    Any ideas how can I solve this?
  • edited April 2021
    Seems like the animation's duration isn't currently multiplied by the animator's speed when using the Animation Clip duration type - will change that in the next update to get the actual animation duration.
    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!
  • Lovely, thank you. Any idea of when that's planned for?
  • Later this week, though Unity 2021.1 tests might delay it a bit.
    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!
  • Hello @gamingislove, did you manage to fix this in the latest release? I can see no mention over here, so in doubts whether I want to go through the updating process unless it's fixed.

    http://orkframework.com/news/ork-framework-2-32-1/

    Thank you :)
  • edited April 2021
    ORK 2.32.1 was just a small bugfix update soon after release of the main update 2.32.0. It's listed under the changes :)
    So, yeah, it's in the latest update.
    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!
  • Awww ok, sorry, I thought I was already running 2.23 Thanks a lot!
  • edited April 2021
    @gamingislove Hi there again. I am still struggling with this problem even after the update.

    The thing is following:
    1. I have a mecanim Attack1 animation of a monster combatant, that by default takes 0.833s.
    2. In order for me, to unify these animations across all of my monster combatants to take 2 seconds, I have set the animation state speed to 0.41x. (I have done this for all my combatants, to achieve 2s attack animations on each of them)
    3. Now, I have the attack event, that animates the attack, waits for normalized time 0.4, calculates the damage, and then waits for the rest of the normalized time 0.6 before initiating another attack.

    The problem here is, that it seems like the normalized time in the event is still not taking into consideration the actual speed of the animation after the speed value of the animation has been adjusted.

    Speed value settings:
    image

    Speed value formula:
    image

    Attack event:
    image

    Animation speed settings in animator:
    image

    Real animation duration:
    image

    Thanks a lot for your efforts.

    EDIT:
    To be more clear, what I would expect here to happen is, that animation takes 2s (it does) and that normalized time 0.4 would result in 0.4 * 2 = 0.8s after which damage is calculated and then 0.6 * 2 = 1.2s wait before taking the next action.

    Here are logs for the broken combatant:
    image
    Post edited by zatokar on
  • I came to the conclusion, that with your new fix, you now take into consideration the Speed value when determining normalized time in the Wait node, but are not taking into consideration the animator speed. It counts like it was always 1.
  • It's taking the animator speed into account, but not the speed of the animation state in your animator - simply because there's no way to do it.

    It's one of the huge issues with Mecanim and why it's not possible to really determine how long an animation takes. It's been years and it's still not possible to do this ...
    That's why Mecanim animations in ORK need this additional animation duration setup in the first place, as it's the only way to either define a fixed duration or getting the speed from the animation clip, but there's no way to get the animation state it's used in and get that speed ...

    So, yeah ... not much I can do about this, but if all your attack animations should have the same duration, you could simply use the Fixed duration type for attack animations and have a fixed wait time through that. This doesn't impact the actual animation speed/duration, though, just the wait time in events.
    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!
  • edited April 2021
    I see. Sad story :(.

    Anyway, I tried your suggestion of using a fixed time which now results in really having the time for each attack to be fixed (2s) and I can't have it based on the attack speed of the monster.

    The animation speed is based on the attack speed and calculated in the Mecanim Settings > Speed Value and that works fine. When I increase Attack speed Status Value of the monster, the animation speed adjusts just fine. But the wait time between attacks always results in a total of 2s for each attack.

    Any idea how to solve that?

    EDIT: I figured I could do some math in the attack event and instead of normalized time, I could set wait time based on the attack speed status value. I guess you were proposing smth similar, just didn't get you straight away.
    Post edited by zatokar on
Sign In or Register to comment.