Units keep falling

  • April 1, 2018 at 04:18 #23017
    jjejj87
    Participant

    I have this issue where units keep falling near the edge of a grid. they just fall infinetly.

    I have 0.5 cell size, 0.3 unit size without rigidbody (just capsule collider) and is using clearance.

    How can I prevent units from falling?

    April 1, 2018 at 08:08 #23019
    jjejj87
    Participant

    Update, this tends to happen in L shaped corners, unit suddenly just changes direction and tries to cut across the corner and starts to fall. I’ve tried to change some settings but seems like it is happening no matter what I do. I am guessing this is a bug?

    April 1, 2018 at 08:28 #23021
    jjejj87
    Participant

    I think I found out more about this issue. In “Path Options Component”, there is a tab called “Next Node Distance” which at default, is 1. What is happening is that when the distance between the unit and the current node is less than 1, it queries the next node, which is fine. The bug, I think is that instead of just quering next node, it repaths from the position, effectively cutting corners early (and in L shaped corners, the inner part has no grid, and hence the unit just falls). I changed this value to 0.1 (lowest possible value) and it stopped doing it.

    Basically, it re-paths early at corners and not waiting for it to get to the current node.

    I think I was able to get around this bug by changing the Next Node Distance, but I am also guessing that when the system is under load with many units, 0.1 distance may not give enough headroom to calculate next node.

    Either way, please look into this issue, I can supply videos and screenshots if you are interested.

    • This reply was modified 4 months, 2 weeks ago by jjejj87.
    April 3, 2018 at 14:46 #23032
    Geminior
    Keymaster

    A path consists of x nodes (positions) and once a unit reaches ‘Next Node Distance’ of a node it starts moving towards the next node until the goal is reached.
    So what you see is the expected behaviour, however keeping ‘Next Node Distance’ less than the cell radius is practically always what you want, so the default value matches the default cell size of 2.
    So with a cell size of .5 you will want it at .25 or below.

    The unit does not repath, so that is not something you need to worry about when setting this value.
    The only thing to consider is the units speed. If the unit’s speed allows it to move more that 2 * ‘Next Node Distance’ in one frame, it may overshoot and start fluctuating back and forth, as it never gets within ‘Next Node Distance’ of the node.

You must be logged in to reply to this topic.