I’m creating a space game shooter, and my spaceship is supposed to shoot a photon (like the ones in Star Trek).
I’m using this image:
What is the best approach to implement an effect like this? It is only one particle, but it rotates, and that image should always face the camera.
I know this is some sort of a generalistic question, but any tips are appreciated
I would do it that way:
- transparent texture on a quad
- use a billboard to face the camera
- rotate the quad arount the center (maybe with random angles)
- move the quad
An extension of what Landei said is to have two counter rotating bollboards facing the camera, the combination of the alpha in the texture makes it look like it's twinkling rather than lust a rotating object.
HTH
Endolf
Good ideas, thanks!
Hey… I’m using TestBillboardNode class from jmetest.renderer, and I’ve modified it to display that image in a skybox enviroment.
But I can’t get get it right.
I’ve set the clear color to gray in this example.
Here is my code for the alphastate:
AlphaState alpha = display.getRenderer().createAlphaState();
alpha.setBlendEnabled(true);
alpha.setSrcFunction(AlphaState.SB_SRC_ALPHA);
alpha.setDstFunction(AlphaState.DB_ONE);
alpha.setTestEnabled(true);
alpha.setTestFunction(AlphaState.TF_GREATER);
alpha.setEnabled(true);
q.setRenderState(alpha);
Any ideas what I'm doing wrong?
For my HUD I use this AlphaState:
Alright, I've got it figured out.
I think it has to do with the sorting and the order you attach your nodes. If you move the rootNode.attachChild(billboard) to after attaching the skybox then it looks great. You don't need to change anything in the alpha state to get this to work.
As a side note, DB_ONE leaves the star a little transparent. DB_ONE_MINUS_SRC_ALPHA doesn't have the transparency problem.
Which ever way you like it.
Good luck appel
Ahhh…!
Thank you for your help :) thanks thanks!
I'm sure I would have run into this soon enough, but now we've learned.