How to set texturecoords for a quad?

Hi,



I want to make an explosion using a simple sprite sheet I made thats 4x4 images on.

ParticleEmitter was not the right idea for this because it loops the images over and over again and the time for each loop differs alot.

So I tought I simply make a plane with a texture on it and then change the texture positions in an update method in an abstractappstate.



But I’v totaly forgot how to change the texture positions… I remember that I’v done this in a previous project, but I couldn’t find that project on my computer so I dont have the code…

Anyways, I’v come this far:

[java]

Quad q;

Geometry explosion = new Geometry(“Explosion”,q =new Quad(1,1));

Material mat_flash = new Material(MainGame.getAsset(), “Common/MatDefs/Misc/Particle.j3md”);



Texture img = ImageLoader.Load(“assets/textures/explosion.png”);



mat_flash.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);

mat_flash.setTexture(“Texture”, img);



explosion.setMaterial(mat_flash);

explosion.setLocalTranslation(position);

MainClass.getRoot().attachChild(explosion);[/java]



And how do I edit the texture coords on the quad now?

look at how the quad class sets them initally

1 Like