I have a small snippet of code that takes a mesh and creates a voxel grid holding the distances of each voxel from the surface of the mesh (a Signed Distance Field for those familiar). It’s really quite easy using the EditableMesh:FindClosestPartOnSurface()
method to get a point on the surface of the mesh, storing the distance from the voxel, and optionally representing the contact point with an attachment.
For voxels outside of the mesh that works perfectly. Voxels are coloured by distance, attachments are showing up on the surface of the mesh.
I’m having an issue though where using EditableMesh:FindClosestPartOnSurface()
inside of the mesh doesnt return a point on the surface of the mesh, rather it returns the voxel’s position - as if it were placed on the surface.
Does anyone know of a solution that might be able to overcome this apparent bug? Or is it simply a limitation of whatever technique the API uses, and I’m going to have to write my own implementation of the EditableMesh:FindClosestPartOnSurface()
method for voxels within the mesh bounds?