Hello everyone. I am building a plugin for adding decorations (in form of smaller objects) to an already setup scene. I want these objects to be procedurally placed on surfaces that are big enough for them to stand on (avoiding putting a large object on an inadequately small surface area), there is also a limitation to the slope on which the objects can be placed (the angle between the surface normal and the world up vector should be under 30 degrees).
I have considered using ray-casting from above to look for points on the scene objects that are positioned on the same horizontal plane but this doesn't work with concave objects that cover up valid surfaces.
Another possible solution I thought of was to go through each scene object's mesh, looking for vertices with the correct normal values and then somehow recursively looking for equally valid neighboring vertices - but this method seems like a huge task.
I need the area of these flat, horizontal sub-meshes to tell if I can place an object there without it looking like it is disobeying gravity.
I appreciate you reading this far, thank you! I hope someone has a good idea, because my head hurts from thinking about this.
**Edit:** I have to add that I am looking for these interesting regions on EVERY object in the scene (perhaps with a few exceptions) NOT just the ground. I am not working with a "terrain mesh" it is an indoor environment consisting of many objects.
↧