- Home /
Making a Cubical Collision Check within a function
Hi,
I was wondering if there's an easy way to make a collision check much like the spherical and line checks offered by the Physics class. Possibily a performant one since I'm on mobile (anyway the function could be called just 1 time every second, worst case scenario).
I'm making a relatively simple tile based game (basically a 3d grid, but I have no grid implemented, also because the level features rotations and other deformations) and I am implementing pushable blocks.
Since I've also got moving enemies, I wanted to check beforehand if, positioning a block in the next position, there aren't any enemies nearby.
If so, I'd put a temporary invisible collider just to reserve the space for the block's movement.
This is basically what I'd like to do. Maybe this is not the best approach to the problem but I'm a bit ahead with the level programming/editing and would be cumbersome to implement a 3d grid system at this point.
I can only think of approximating it with a big spherical check followed by 8 smaller spherical checks, each one near the cube's vertexes.
Thanks for your time.
Your answer
![](https://koobas.hobune.stream/wayback/20220613135741im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
2D Tile Based collision problem 0 Answers
how to get off the enemy from the player top? 0 Answers
How can I prevent my player from passing through tiles? 1 Answer
Solutions for isometric collision 1 Answer