Particlemonkey issues and workarounds

Hi,

I’ve been having fun with jmonkey and the particlemonkey library.
Thanks for all the work on those.

Unsurprisingly I’ve hit some issues along the way. I was able to work around them, but in case this helps anyone:

I was using version 1.1.0 via maven and trying to get an emitter to leave behind a row of particles via
emitter.setParticlesFollowEmitter(false);
Somehow those ended up overshooting to behind the origin.
I got the effect I wanted after adapting ParticleDataTriMesh
via emitter.setParticleMeshType(MyParticleDataTriMesh.class, null);
and removing line 281:
“tempV3.set(p.position).subtractLocal(emitter.getWorldTranslation().subtract(p.initialPosition));//.divide(8f));”
in my class … which i later realized is also how the current git version does it …

I’ve also been having some problems with ColorValueType and gradients.
There might be a bug in ColorValueType in the getValueColor method at line 133.

final Gradient gradred = new Gradient()
	.addGradPoint(new ColorRGBA(0,0,0,0), 0)
	.addGradPoint(new ColorRGBA(1,0,0,0), 1);
final Gradient gradblue = new Gradient()
	.addGradPoint(new ColorRGBA(0,0,0,0), 0)
	.addGradPoint(new ColorRGBA(0,0,1,0), 1);
			
ColorValueType cvt=new ColorValueType();
	
cvt.setGradients(gradred,gradblue);
			
System.out.println("half time, half interpolate: "+cvt.getValueColor(0.5f,0.5f,new ColorRGBA()));

I’d expect the output to be something like Color[0.25, 0.0, 0.25, 0.0]
It’s Color[0.0, 0.0, 0.5, 0.0] though.

if we pass a “store” value, it gets assigned to “output” as well.
Then
output.interpolateLocal(store, particleRandom);
interpolates with itself?

if we pass null as store to getValueColor, it triggers an error in the interpolateLocal call because it is still null there.

I’ve worked around that by extending ColorValueType and always using a dedicated
tmp ColorRGBA value to interpolate.
(it’s a bit ugly as the gradients are private in ColorValueType)
Here the git version seems to be the same as the 1.1.0 release.

2 Likes

Soooo the copy in Maven is fairly old at this point. Pretty sure the particles follow emitter bug was fixed a while ago. I haven’t gotten around to publishing a new version because I’ve been making some changes for the particle editor I have been working on.

I just fixed that store bug in my local copy, thanks for the heads up. If you have any others feel free to send them my way. I’m well past due for publishing a new version.

3 Likes

Thanks for the swift response.
A new official version would be much appreciated.
I’ll certainly report if I run into any other issues.