The distribution still won’t be random because some cells are larger than others. A true random distribution will have more points land on larger cells than on smaller cells, but yours does not.
<cite>@Momoko_Fan said:</cite>
The distribution still won't be random because some cells are larger than others. A true random distribution will have more points land on larger cells than on smaller cells, but yours does not.
you’re right, but what i wrote works better (towards what i want)
the whole navmesh gets flooded with points compared to the screenshot i provided
maybe distribution is not the correct word…
anyway, if you can tell why it is not working with the original function, that would be great
(edit : also, some points were agglomerating on the cell side, so I checked the code and noticed that the getRandomPoint uses 2 cell side’s normals to create the point coordinates then chop it to the triangle area wich leads to condensation of points on one side of the triangle
anyway, just give it a try, you’ll see that the randomness is distributed all over the navmesh, maybe not evenly, but for what i needed, it works as (i think) it should be)
I did a weighted mesh generator for the new particle system - that selects a triangle based on its size and then picks an evenly distributed point at random within that triangle.
<cite>@zarch said:</cite>
I did a weighted mesh generator for the new particle system - that selects a triangle based on its size and then picks an evenly distributed point at random within that triangle.
You might find the algorithm I developed for that helpful.
thx for the link
but i did not mean distribution regarding triangle area
what i meant is that the current getRandomPoint function, discards some parts of cell triangles
where random point will never be generated
thx anyway cos i wanted to dig about that topic too
The algorithm finds every triangle in a mesh. It weights those triangles based on the area of that triangle.
It can then pick a random triangle based on those weights so that any point on the mesh has the same chance of being picked no matter the size of the triangle.
The code to pick a random point on the triangle gives an even distribution as well.
<cite>@zarch said:</cite>
Just noticed I hadn't committed a fix to the weighted mesh thing actually - fixed version is at http://code.google.com/p/jmonkeyplatform-contributions/source/browse/trunk/ParticleController/ParticleController/src/com/jme3/particles/source/WeightedMeshSource.java
The algorithm finds every triangle in a mesh. It weights those triangles based on the area of that triangle.
It can then pick a random triangle based on those weights so that any point on the mesh has the same chance of being picked no matter the size of the triangle.
The code to pick a random point on the triangle gives an even distribution as well.
talking about that, do you think it is possible to have particles working backward ?
like, instead of beein emited from a point or a mesh, they are goind toward that mesh/point, being emited at a particular distance(regarding face normals when emited from a mesh)
<cite>@zarch said:</cite>
Yes. You could certainly do that with the new system.
You would need a custom source to spawn them and a custom influencer to take them towards the destination.
cool, indeed for flexibility, one must be able to act on generation and on motion of particles
also i duplicated the particle system to modify it, the plan was to create a cloud where particles are confined to a cube for example, bouncing agains its limits
is it possible to do that with the new system ? maybe even further, particle collisions (insde or outside mesh) would be neat
another nice feature is color gradients… are you planning to do that ?
is the new particle system + examples already part of the v3 ? or nightlly build ? or repository ?
It’s available from the SVN already if you want to try it - after the drama when I released it I’m leaving it for a while then going to do another release announcement and get it into the plugin list - it will have some more features and suchlike by then as well since I’m currently using it for real in HeroDex and coming up with things to add.
Feel free to add more ParticleSource and ParticleInfluencer options as well if you feel like it
It’s available from the SVN already if you want to try it - after the drama when I released it I’m leaving it for a while then going to do another release announcement and get it into the plugin list - it will have some more features and suchlike by then as well since I’m currently using it for real in HeroDex and coming up with things to add.
Feel free to add more ParticleSource and ParticleInfluencer options as well if you feel like it
Someone else started working on a particle library and then disappeared. I wrote mine (inspired by and using bits of code from hers I fully admit, but she had disappeared and released hers under open source library). She reappeared just as I was about to release mine and demanded that I not release it and accused me of plagiarism, stealing credit, taking her code and publishing it under my name, etc, etc, etc.
I felt sort of sorry for her since it turned out she’d been hit by a drunk driver and was offline as a result but there was no discussion possible, just hysterical accusations and demands that I not release it. So I released it and she rage quit.
<cite>@zarch said:</cite>
Someone else started working on a particle library and then disappeared. I wrote mine (inspired by and using bits of code from hers I fully admit, but she had disappeared and released hers under open source library). She reappeared just as I was about to release mine and demanded that I not release it and accused me of plagiarism, stealing credit, taking her code and publishing it under my name, etc, etc, etc.
I felt sort of sorry for her since it turned out she’d been hit by a drunk driver and was offline as a result but there was no discussion possible, just hysterical accusations and demands that I not release it. So I released it and she rage quit.