- Home /
Shuriken - Any idea what causes '!CompareApproximately (SqrMagnitude (axis), 1.0F)' error when switching to mesh particles?
Hello, I tried posting this on the Unity forums but thought this might be the better place to ask.
I'm manually adding particles to a Shuriken emitter in a similar way to the tutorial here: http://catlikecoding.com/unity/tutorials/graphs/
This works fine with normal billboard particles, but I when I try to switch to mesh particles I get the following error:
!CompareApproximately (SqrMagnitude (axis), 1.0F)
Any ideas why this might be? I need to use meshes as I'm using Shuriken to render clouds, and billboards don't really look great once you get close to them. It's possible I'll have to fall back to the legacy particle system, though that doesn't render mesh particles by default, as far as I know.
I've uploaded a sample project that illustrates the problem here: Sample Project (Dropbox)
Once you hit play, you should get the error message (quite a lot will come through, I think it's per particle, per frame). If you switch the particle renderer to one of the billboard types it's fine though.
Answer by Braddas · Jun 13, 2013 at 06:52 PM
Okay, I managed to work around this. I enabled the emitter and set it to emit a single mesh particle. My script waits for the particle to appear (when particleSystemObj.GetParticles(particles) > 0), then it switches the emitter off. It then sets a sourceParticle variable to the particle that was just created by the emitter. Whenever my script creates new particles it first sets each one to equal sourceParticle, essentially duplicating the original. After that I can modify it however I want, without any errors.
I'm not sure if this is a bug, or if you just aren't supposed to create particles without an emitter, but hopefully this will help somebody else too.