The method I’m using now creates binary point values i.e. they are either empty or filled. I need a method for a smooth sphere.
public Vector3 center;
public float radius = 10.0f;
public float GetValue(float x,float y,float z)
{
float distance = Vector3.Distance(new Vector3(x,y,z),center);
if(distance < radius)
return -1.0f;
return 1.0f;
}
The value needs to be in the range of 1.0 to -1.0, 1.0 being full and -1.0 being empty.