I’m trying to simulate a boat and I’d like to detect if my model is air tight (which will then affect the bouyancy values).
I have no trouble with the bouyancy, or the depth mask etc. My only issue is detecting whether there are any leaks in the both.
My first idea was to raycast in many directions over a number of seconds to calculate if any of those hit the water first but in my mind it seems a little over kill as a large boat may require 100-300 raycasts.
Then I was thinking about lighting and how it is able to detect which faces should receive light based on the normals and how they are facing.
Is there some way I can leverage off of this, perhaps I can shoot a light in 3 directions, from each side and the bottom then detect the normals of all faces and see if I can see faces that I shouldn’t be able to (like the other side of the boat as if I’m peering through a hole)??
*** EDITED:
Now my head is thinking of filling the hull with adjacent cubes and detecting collisions… I’m sure my head is in the right spot I just don’t have the mathematical knowledge to figure this out.
assuming that they can’t change it all the time, easiest will be to put the boat into an all white environment, color the boat all black, use a camera in 1+ positions within the boat middle axis and capture cubemaps and then use this to find out if you find white thats enclosed by black
with raycasts you can do it too, just move through from front to back and cast rays.
as you likely only need to do it once, the time required should be rather unimportant (if 1s or 2s), as you can stealth it behind some “shit being constructed” sequence or alike.
I’ve gone down the road of raycasting but spreading it over a number of seconds and I only start the routine when the model has detected an attack powerful enough to create a hole.