# Weekly Devlog 4: Placement and Inventory

%[https://www.youtube.com/watch?v=GT40_bQMpsQ] 

I worked on a minecraft inspired way to place the tiles, using a inventory. Progress has been slow due to some unexpected bugs and a lot of work spend on optimizations that are not visible.

## Physics optimization

There are two types of builds in this game, either they are dynamic or static. For dynamic objects I have no choice but to use primitive colliders for each individual tile (although I could attempt to merge some), but for static objects I can generate an optimized concave collision mesh. Doing so required writting a specialized job that works on some raw mesh data. I found out that unity does not take mistakes well when it comes to pointers.

![](https://cdn.hashnode.com/uploads/covers/689f8c80e2f0031b7d8d828e/a612c5b1-898b-47bd-8839-7caaa520e66a.png align="center")

The main challenge was that while the object will only ever have 1 mesh, it can have multiple mesh colliders. PhysX limits the number of triangles on a Mesh Collider with Fast Midphases baking enabled to about 2.000.000 triangles (although it seems to cause issues even just with >2.000.000 indices). So the job generates multiple meshes instead.

![](https://cdn.hashnode.com/uploads/covers/689f8c80e2f0031b7d8d828e/9f0dadb2-3afb-4e8c-8793-a2d50e381268.png align="center")

I also added the option to specify a simplified collision mesh, as for my test tile which is just a cube with beveled edges, a standard mesh cube is a more optimized collider.

![](https://cdn.hashnode.com/uploads/covers/689f8c80e2f0031b7d8d828e/fe22fe79-64cf-42cb-b243-1d690a2f6a29.png align="center")

I also added some debug information about how many vertices and triangles there are in the scene.

![](https://cdn.hashnode.com/uploads/covers/689f8c80e2f0031b7d8d828e/3f5fbbaf-e162-4376-b4e6-29c47c06943d.png align="center")
