Discount get point inside mesh

Hi everyone,

We already have “Create Points Inside A Mesh”.

But this is quite heavy. In my use case I want to fire a couple of bullets against a box collider. All the bullets should collide but have a slightly deviated target vector. It just looks stupid if they all travel on the same trajectory.

Anyway, here is the discount version of the point-inside-mesh function: Babylon.js Playground

Limitations: it samples in a sphere.

Best wishes
Joe

I did something a bit related for a side project using convex hull. It starts with a point inside or outside the volume. For each plane, keep it if one the inner side. if point is on the outter side, then project it onto that plane. It a convex hull so hole will not be taken into account.

2 Likes