Detecting collisions on an invisible grid
I have been trying to make a simple game where an object moves infinitely on an invisible grid until it hits a wall. As I don't need the floor tiles to have different textures I did not actually implement a tilemap which I could use to detect collisions. I rather created a Box Collider of the size (1,1,1) for the moving object and made the movement stop at walls (cubes of the same size) with OnTriggerEnter().
This works fine - almost. The object stops precisely with a distance of 0.5 to a wall. However, it will not pass by them. OnTriggerEnter() already seems to be called when the colliders' edges touch. This also forces me to lower the floor plane, otherwise the object will collide with it right away.
I could simply make the moving object's collider a little smaller, but obviously this would make its movement deviate from the grid. Applying physics materials with zero friction to all objects did not help either. Of course I could check the collision on the grid programmatically, but this seemed like a very straightforward way to do it, so can it be fixed somehow?
Your answer
Follow this Question
Related Questions
Sphere bouncing back on edges of aligned objects 0 Answers
Restrict held object movement 0 Answers
Position and collider seem to incorrectly shift when moving object 0 Answers
hi guys am having a problem with my player 0 Answers
how to prevent a kinematic rigidbody from going through static colliders 0 Answers