naelstrof / KoboldKare

A public repo for the game KoboldKare
Other
86 stars 104 forks source link

Loosing items under breeding barn and kitchen often. #122

Closed GeminiSquishGames closed 1 year ago

GeminiSquishGames commented 1 year ago

I do this often enough that it's a problem and frustrating, that items like eggs, the scanner especially, and buckets/toughs are getting stuck in the space under these barns. My prediction is that you have a collider for the building and one for the foundation in conflict, maybe. The one for the top of the floor of the barn has another under it that also collides with the upper portion of the interstitial space (crawl space). So if something gets pushed through It can't escape due to the two colliders close or overlapping fighting with each other. I can grab things with shift grab through the slits of the kitchen sometimes and it wedges between the two colliders. Takes work but I can get them back out. Smaller eggs are typically lost if I can't grab them in the breeding barn.

Discreet or constant physics calculations can help things not clip, if you don't already use that, but isn't so great for hundreds of rigid bodies. A fix might be to make sure there are no upwards collisions on the floor so that things don't get pushed down by the colliders fighting into the interstitial space so easily and if it still happens they can be pulled back up more easily, perhaps. Another fix, if it still happens, might be to have that foundation collider also have a trigger that takes items lost there and puts them in a lost and found type space or just push it up on the Y axis to the floor of the barn again. Not sure if you have anything like a lost and found for rouge physics objects but for physics-based games I usually make lost objects that fly off the map for whatever reasons go to a logical location when lost, either by seeing an absurd position value or having triggers in trouble spots. I have had larger eggs lost if the kobold's body lean, using R, is too far back, pointing the egg down on the outside nest.

naelstrof commented 1 year ago

Yeah this is due to purely relying on mesh colliders to do the collisions. The floor planks are pretty complicated and are double-sided, so stuff easily can get depenetrated the wrong way. I've added some good old box colliders that will probably fix it. I'll reference this issue when I push the commit.