Creating a explosion

Hello everybody, I have a single question to do for you.



How can I create a simple explosion? like a function called createExplosion(float x, float y, float z);?



Regards, Gustavo.

1 Like

I don't know how to do explosion with JMonkey. But a video on youtube made me realize how it's simple to make explosions in OpenGL. http://www.youtube.com/watch?v=5I5An-4sz1s. It's shown near the end of this video.

1 Like

This can be done easily using the particle effect system. I'd run RenParticleEditor.java in the jmetest.effects package, which has a set of examples you can play with (and save to the binary format).


1 Like

Can you show me the example?

1 Like

look for jmetest.TutorialGuide.ExplosionFactory which is used in the TestPongCool example.

1 Like

There are a couple of explosions in the effects section of the Exodus Defence SVN. Should load right up into the particle editor. They’re not all that great but might give you a starting point.

1 Like

What am I supposed to do with a .jme file?

1 Like
GustavoBorba said:

What am I supposed to do with a .jme file?

It is jme spatials in binary form. You load them with a com.jme.util.export.binary.BinaryImporter.
1 Like

Can you sow me a example how to load it?

1 Like

Since you are doing a lot of posts requesting code examples I strongly suggest you download the source code of jme from here and have a look at the examples in the jmetest package. Almost all functions of jme2 are shown there and it is a good reference to find code examples.



You can find information on how to setup the source code of jme2 in NetBeans to run all the tests in the wiki.



An example example for loading jme binaries is in jmetest/TutorialGuide/HelloModelLoading.java you’ll have to leave out the conversion part since you’re not loading an obj model but a jme2 binary.



Hope that helps,

Normen

1 Like

2 Questions  :|:



1 - I downloaded and  I have take a look at binaryImporter, but could not understand that. I know I have asked a lot for examples, but know is serious, show me a piece of code, so I can base my work on it, please.



2 - I have jme-bullet working, but will the .jme explosion affect the objects? Like a push wave/shockwave.

1 Like

the .jme is just the animation, the physic have to be implemented by yourself. try jbullet or jme-jbullet

1 Like

I Have this piece of code to load the explosion:


URL explosion = prjNukeIt.class.getClassLoader().getResource("effects/explosion-nuke-nosmoke.jme");

        ByteArrayOutputStream BO = new ByteArrayOutputStream();
        try {
            ParticleMesh explosionEffect = (ParticleMesh) BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));
            rootNode.attachChild((ParticleMesh)explosionEffect);
        } catch (IOException ex) {
            System.exit(0);
        }



It doesn't work. What am I doing wrong? There are no errors on the log. PLEASE, HELP ME!
1 Like

It might be there and just not in view.

You’re best just copying one of the jmetest demos and changing the path, then work from there.

Also here’s an example:



http://code.google.com/p/edefence/source/browse/trunk/src/com/calefay/utils/LoadParticleEffect.java

1 Like

That's just because it doesn't add the extension automatically. Just add in on yourself.

1 Like

The error persists, Alric.

1 Like

So I take it that you can load it back into RenParticleEditor successfully?

Try taking the loading code straight out of there.

1 Like

I can load it on RenParticleEditor, but can't add it into my game. I'll create a topic for that.

1 Like