Question

I am in the process of creating a 3D sci-fi game. I have a nice 3D environment with asteroids, enemies, cruisers, and terrain. However, I cannot get the position of a specific particle. To be more specific:

I can get the initial position of where the set of particles will generate.

I Cannot: Get the position of where a current specific particle is. (Let's say it has been "fired" by a cannon a few seconds ago)

What am I attempting to do? I am trying to eventually create a particle collision detection system by getting each particle's x y and z so when a particle hits an object (like the asteroid arraylist I created named rocks) it will disappear, and other events will occur afterwards (like damage to an object, etc). I know how to create a collision system, but are clueless without a way to use a get() method to find the position of a particle. I have checked the javadocs of the JavaMonkey3 engine and the env3d engine (I am using both), but to no success.

Is this method possible, or would it just be better off to create a new .object each time a ship fires a cannon? (A .object's x,y, and z can be tracked.) For reference, javamonkey's main particle class: http://hub.jmonkeyengine.org/javadoc/index.html?com/jme3/effect/ParticleEmitter.html

Was it helpful?

Solution

1) If you call getParticles()

http://hub.jmonkeyengine.org/javadoc/com/jme3/effect/ParticleEmitter.html#getParticles%28%29

you should get a list of all Particles. Particles have the "position" datatype, which you can access.

http://hub.jmonkeyengine.org/javadoc/com/jme3/effect/Particle.html

2) then you can iterate through your particles and check if a particle is colliding (in your implementation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top