# Particle System Sphere.

Hello guys i apologize if this has been asked before in all honesty i couldn’t find anything. I’m trying to create a sphere using a particle system. I’m using what i think would be the function of a sphere. Any reason why my output has that incomplete shape? or perhaps my function is off?

private static float Ellipsoid(Vector3 p, float t)
{
return 1f- (p.xp.x) - (p.yp.y) - (p.z*p.z);
}

If you multiply 2 negative numbers together you always get a positive, by doing that on all 3 axis you’re only getting one eight of a sphere visible. Somebody on the forums would probably give you a better ‘maths’ solution but one possible method would be to remember the sign of p.x/p.y/p.z before you multiply them together and then replace it afterwards.

1 Like

@tonemcbride If I understand what he’s doing correctly that seems like the intended effect. That function will return a positive number for any point inside the sphere, and a negative number outside.

Are you checking if the number is positive, then spawning a particle at that point? (that’s what it seems like from the voxelised look of the sphere) If so, my immediate thought is you’re only looping from 0 to 1 on x y and z, when it should be from -1 to 1.

1 Like

I think you are right i believe thats what the problem is. Thank you ill look into it.