Calculating distance between meshes
Hi I'm building a game similar to the "Operation" board game (here's a fun intro in case you don't know it)
In my game, players draw a path through an obstacle course and launch a projectile. The projectile follows the drawn path and if there is no collision, scores points. If the projectile comes close to the obstacle walls, the players loses points depending on how close the projectile is to the wall.
Now, the problem I'm facing is that both the projectile and the wall are both irregular shapes. I can easily detect the collision but for the life of me, I can't figure out how to calculate the distance between the projectile and the wall when it's just close by.
I could calculate all the vertices on the projectile and shoot raycasts to hit the walls and calculate the smallest distance to the wall but this brute-force method feels inefficient.
Any suggestions?!
Your answer
Follow this Question
Related Questions
Press E to Read note 1 Answer
[UNET] Rigidbody physics sync 0 Answers
Moving a rigidbody in local space with transform.TransformPoint has unexpected results. 1 Answer
How to make physics for the string of a rising balloon 1 Answer
Why do my physics objects rotate randomly sometimes when reparented 1 Answer