Well as far as I have understood the Jme system. A childnode will inherit the rotations of the father. But this does not seem to be the same with particles if they are added to a node?, The emmesion direction is not rotated.
Is this a bug or the way its supposed to be?
It’s probably a bug… I’ll look into it later when I get back.
It depends on how you add it. If you are setting geometry to your manager, (i.e. the thing that determines where particles come out of), this geometry needs to be added to your ship as a child.
I dont I judst say shipNode.addChild(manager.getParticles());
Hi Middy,
I’m having this exact same problem as well. I posted about it here
http://www.jmonkeyengine.com/jmeforum/viewtopic.php?t=1475
Haven’t found a solution yet though.
Well, you can set geometry for instance a Disc, this geometry defines the area (or volume) that the particles can be generated from. You then attach this geometry to your ship and your particles will be generated based on the rotation of the particle geometry (who in turn rotates with the ship).
See the TestDynamicSmoker tests.
well I solved it by just constantly updatng the particles with the fathers rotation. Dunno if the other method is more effecient
??? I’ve posted twice about the optimal solution. Setting the geometry you can position it at the engine port, at the gun barrel, etc.
Hi Middy,
I"m at home (not school) so I can’t test this yet but I assume Mojo is recommending the use of
ParticleManager.setGeometry(Rectangle rect)
Then just attach rect to your shipNode and translate it and rotate it to the correct position/orientation.
Then when your shipNode gets updated the rect will translaste/rotate as well and the particles will emit in the correct direction.
yes, that is what I was referring to. I just realized I never mentioned the method name, etc. Sorry about that.
oh sorry about that. I didnt want to sound buggy. What i realy meant that at the question time I already had a working solution and would fix it later
Middy
Even using the emit from geometry solution will not really change the emission direction issue (see the TestDynamicSmoker, you’ll see we update the emission direction in simpleUpdate as well.) It makes sense that the emission direction would be relative to the object’s world rotation. I’ll have a fix in for that by tomorrow evening.
awesome … can’t wait.
Ok! This is all done now… Basically, the rotation of the parent scenegraph is now taken into consideration in the following way:
- If you are emitting from some Geometry (ie. manager.setGeometry(geom); ) then the worldRotation of that Geometry is used to rotate the emissionDirection.
- If you are emitting from a point, line or rectangle, the World rotation of the particles themselves (ie inherited from the scenegraph) is used.
I also updated TestDynamicSmoker, just removing the simpleUpdate method as it is no longer needed.
I apologize for the updated indentation on ParticleManager… I know that makes it hard to diff, but the old indents were horrendous. Now it’s inline with our standards.
Enjoy!
Works great … Thanks Renase!
Sure thing.