I have been working on a 2d game with ork, using the grid battle system. As usual , since its 2D, i disabled all rotations, lookat, etc... However i would like the sprite to change based on the direction the combatant is looking.

I have found this, explaining how u can use an event to hook it up with the check orientation node.
http://forum.orkframework.com/discussion/comment/15856/#Comment_15856

However i dont really know how to execute an event whenever the combatant orientation changes.

Any idea how to approach this?

Thanks in advance!
  • Hm, that might be best handled by animations instead of events.

    When using Mecanim animations, you can forward rotation information to a parameter of the animator controller and play an animation (e.g. changing the sprite) based on that. It's set up in the ORK animation settings.
    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!
  • Thanks for the reply!

    I understand what u are saying, now i just have to implement it!

    Guess i overlooked the auto rotation parameters in the mecanim settings :D
  • I have checked out the Auto Rotation Parameters in the mecanim settings but i still have some questions.

    First of all it doesnt seem like the orientation change gets sent to the animator.
    I have set up a float, like i do with horizontal en vertical movement, but when selecting the orientation (in battle after placing a combatant) the rotation doesnt get recognized. I also tried turning the rotation on when selecting orientation, but that means it flips the sprite and it becomes invisible.

    Do i do something wrong?
  • edited August 2020
    Hm, what's your setup?
    It'd only by a Float parameter if you're using Full Degree, the other 2 use Integer parameters. And make sure to forward the correct axis.

    Also, I'm sure you've got that, but your combatant's animation settings also has to be set to use Mecanim (i.e. in the combatant's settings).
    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!
  • I have managed to get it working with the direction input, and it accesses the animator correctly.

    However i still have an issue, i should use the rotation settings, and the values get sent to the animator correctly. but when using rotations in 2D its generally not a good idea (cause Y axis can hide the sprite on 90degrees).

    Is there a way to stop the auto rotate (on the transform), yet still send the values to the animator using ORK?


    The setup is a 2D turnbased game using the grid battle system.

    Thanks in advance

  • Well ... not really - you either use rotation or not, but you can't not rotate the game object and still send rotation to the animator (via ORK).

    You can either use the event system to set parameters using a Mecanim Animation node based on direction checks, or use a custom script to handle that.
    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!
  • That is why i , in my initial post, i asked for some info for a way to hook it up to an event using the check orientation node.

    The problem was there is not an event (as far as i know) u can execute when a combatant gets placed and its orientation gets changed.

    To clarify what i try to achieve:
    1) player selects combatant and places it on the grid
    2) player selects orientation, and the correct animation gets displayed
    3) when attacking a target, update the orientation to the correct direction

    Implementing the event is not a problem as it can be done using the check orientation node if i can just check orientation to the cell(i think). The problem is when to fire the event.
  • edited August 2020
    I think the best way is to have an autostart event on your combatants that regularly does that, i.e. using an Event Interaction with start type Autostart. Use a loop in the event (e.g. linking back to the first node after a short Wait node) to continue executing the checks/changes.
    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!
Sign In or Register to comment.