Particle system zggdx z coordinate

I want to visualize the particle effect in 3D using the Z coordinate. I tried to implement my own ParticleEffect using labels instead of sprites without success.

Is there any other way to render ParticleEffect using the Z coordinate? Maybe by manipulating the SpriteBatch transformation matrix?

Update:

working code

// update projection each frame since my camera is moving spriteBatch.setProjectionMatrix(camera3d.projection); for (ParticleEffect effect : effects){ spriteBatch.setTransformMatrix(camera3d.view); spriteBatch.getTransformMatrix().translate(x,y,z); // different for each effect spriteBatch.getTransformMatrix().scale(0.1f,0.1f,0.1f); //optional spriteBatch.begin(); effect.draw(spriteBatch, delta); spriteBatch.end(); spriteBatch.getTransformMatrix().idt(); } 
+6
source share
1 answer

If your 3D effect is a parallax effect, that is, your particles face the camera perpendicularly, you can really set the SpriteBatch transformation matrix

 batch.getTransformMatrix().idt().translate(0, 0, z); batch.begin(); ... do your rendering here batch.end(); // reset the matrix, so you can use the batch for other stuff batch.idt(); 

For a perspective effect, you will also need to use perspective projection. The easiest way to handle this requirement is to use PerspectiveCamera instead of OrthographicCamera.

+9
source

Source: https://habr.com/ru/post/917168/


All Articles