Best way to detect a valid move to an object.
Hey Peeps
i have a 3d view, with an character that skips a set distance (15) between tiles laid out in the scene which are (15x15). All works well.
to stop the character object being able to skip from a tile into the void beyond the setup, how best can i achieve this?
so far i have used the following to collect the colliders in the target movement location as i have set the tile prefab to include a "Box Collider"
Collider[] colliders = Physics.OverlapSphere(facingVector, 5F);
Then, i basically run through a "Switch" scenario to check the "Tag" for all the colliders found in that 10F area. i have all the tile prefabs tagged as "Floor". If the tag is found i can move, otherwise i do not.
generally this works as intended but feels a little clunky.
What are my other options here?
Your answer
![](https://koobas.hobune.stream/wayback/20220612124653im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to move an object without impacting it's natural gravitational behavior 1 Answer
Player keeps bumping when walking over to another sprite 1 Answer
Move object without leaving bounds 0 Answers
Character shaking on moving platform (elevator) 2 Answers
two objects collide, but slightly enter into each other. 0 Answers