Search Unity

Basic grid overlay

Discussion in 'Getting Started' started by MadboyJames, Dec 10, 2019.

  1. MadboyJames

    MadboyJames

    Joined:
    Oct 28, 2017
    Posts:
    262
    I would like to be able to break my game world into "quadrants". Currently this is not for a specific project, but rather a general tool for data management. Essentially I'm wondering how to say "make a 10x10 grid" and have the code draw that (using debug draw or gizmo draw. This will not be for the player.)

    Use case 1: looking for unit positions (units can say I'm at X of 20, Y of 2.5, that's quadrant 8, then add themselves to a list "units in quad 8") So then another unit can say, "who is in my quadrant?" when looking for an enemy. (Technically a trigger collision box would be cleaner, but this is just one use.) (Note: I'm not asking for help with use cases.)

    Use case 2: simulating liquid/ gas flow, or other simulation elements.

    Use case 3: strip map graphics and hold data to use in a minimap, or for ease of anything trying to access world sum numbers.

    Use case 4: procedural word populating/ biome sets.

    Tl;DR: How can I have a grid overlay my world?