Hello, i’m currently developing a tile map system and now I’m looking at how other objects will interact with the tile map. I’ve already created a optional system that will create a polygon collider for each 10 by 10 region of the tile map but on larger scales the procedural generation of the collision boxes becomes rather expensive and i cant see any way to improve the efficiency of the system by a large enough margin to make it viable.
so now as a placeholder i’m using simple physics script that handles basic input, gravity and collision with the tilemap. it calculates the collision by predicting what the next location of the object will be on both the x and y axis, the next location is then altered depending if the change on either axis results in an overlap with the tile map. very simple stuff.
i’m now looking at the possibility of creating a script that will act like one of unity’s built-in colliders so to allow me to use the built-in physics engine while avoiding the cost of generating ploygon colliders.
i would appreciate it if anyone has any advice or experience with this subject. i would also like to know how exactly do the colliders and rigidbodys communicate with each other. do they just use the message system, e.g. OnCollisionEnter.