I've got a CheckRotation Node to turn my player when instead of moving directly onto a cell.
However, When facing TopLeft it treats the player as also facing both left and up, meaning they cannot turn those directions to attack an enemy without first turning away and then turning back.

image

image

image

  • edited June 20
    Well, yeah - check orientation only has 4 directions, so some edge cases can overlap as in your example.
    Since you're dealing with 8 directions you want to check for, you can instead use the Check Angle node.
    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!
  • Are you able to shed some more light on how to use this? I've been putting in various values, and the best I can get to is being able to move up and left, but not down, or I get stuck at an intersection with some elevated terrain.

    image
  • edited June 27
    It'll be best to use Range check types here, e.g. Range Inclusive. Angles in Unity can be a bit confusing, forward/north is an angle of 0, backwards/south is an angle of 180 and -180, right/east is 90 and left/west is -90 ...

    The Check Orientation node basically does the same thing, checking for 90 degree angles (e.g. -45 to 45 for front/north). So, if you want to check 8 directions, you'd check in 45 degree angles, e.g. -22.5 to 22.5 for front/north.

    So, for checking back/south direction, you'd need 2 checks, e.g. one range check for 157.5 to 180 and one for -157.5 to -180.
    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!
  • Thanks, i've got the character rotating and I can swap to the opposite direction. However, moving is behaving really weird. If i face down, the character believes it's facing up, or atleast it's return a success for the orientation (if my character Isn't facing the movement direction, they're supposed to turn to face, then they move on next input - so what's happening is if i turn and face down, then move up, instead of turning, the move is executed. If i face down again, and try to move down, nothing happens)

    image
  • Hard to say with only seeing a part of the schematic - also, is this with continuous input, i.e. schematic checks input and continues again from the start?
    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!
  • Here's the full schematic Movement Schematic

    It is continuous input, but the rotation aspect is not. It ends the action. There is a "lock" button that stops a player from moving if they wish to ensure that they only rotate to a specific position.
  • I seem to have some success with the ranges -22.5 to 22.5 and then 22.5 to 67.5

    I'm not sure what any of that means, but it works?
  • You'll have to check for all rotations, i.e. all directions:
    North: -22.5 to 22.5
    North east: 22.5 to 67.5
    East: 67.5 to 112.5
    South east: 112.5 to 157.5
    South: 157.5 to 180 and -180 to -157.5
    South west: -157.5 to -112.5
    West: -112.5 to -67.5
    North west: -67.5 to -22.5
    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 actually had some counter-intuitive logic, in the result was always "true", the character was always facing one of those directions. So it never stopped to face the new direction, it would just move. If it faced east and i pressed west, it moved west, instead of just turning to face west.

    I found i needed to actually remove the 2nd check, and only have a single angle check of -22.5 to 22.5. Since this is local data, it's taken from character perspective which should always be facing forward, and only actually move once that's true.
    Now, regardless of which direction i'm facing, i can turn to face any other direction (where before e.g original question about facing topleft,i can now face both top and left from that position without issue.

    But thank you for taking the time to explain these angles to me, it was a real mind twister at the beginning.
  • Sorry, might have phrased it wrong - I meant that you need to check them based on the input direction you're getting.
    The schematic you posted above has all input checks go back to the same Check Angle node. Instead, you need to have the matching angle check for the input you checked for before, e.g. forward/north input checking the north angles, etc.
    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.