Multi Grid Dynamic Obstacles

  • September 22, 2017 at 08:18 #22025
    dragon slaya
    Participant

    I read on forum that current dynamic obstacles only work on single grids but can be made into working with multi grids. I have tried to figure it out and so far only failed attempts.

    I have gotten as far as getting it to update on both grids but all it does is update blocked ares but wont update the blocked updates back to unblocked even tho colliders are not anywhere near the blocks. Here is the current code using dynamicObstacle.cs as my base line.

    If you could point me in right direction of what i could be doing wrong or if everything is correct and it should be working but its not.

    September 24, 2017 at 13:52 #22040
    Geminior
    Keymaster

    The problem is that the bounds of the obstacle is represented by a MatrixBounds.
    This cannot be shared between grids as it is a range of indices in a grid.

    So you either need to have one such bounds per grid involved (and remember to clean it up) or find another way to represent the bounds.

    The MatrixBounds is convenient since it allows direct indexing into the grid, but as mentioned it will only work for a single grid. Using normal Bounds is an option, but then you will need to change the iteration over cells etc.

    September 29, 2017 at 04:08 #22084
    dragon slaya
    Participant

    Thnx for the info. Ill try to figure out something and post what I get if i need further help.

    September 29, 2017 at 23:34 #22088
    dragon slaya
    Participant

    Here is what I came up with if anyone at apex could let me know if im correct or if there maybe a better way to do this or if any info on if i am doing this wrong or its good please let me know. It currently works and i have no performance issues atm.

    September 30, 2017 at 16:36 #22093
    Geminior
    Keymaster

    I can see that you have gone for storing a MatrixBounds per grid as I suggested, and, as you say, it works so all is good.

    I would mention that using foreach loops, ForEach extensions and lambdas all allocate memory, so you really should avoid that.

You must be logged in to reply to this topic.