I want to use 2D images(sprites) for my characters, because I am not a modeler. They should be facing the camera all the time(billboards), they should have simple animation, where they switch images and they should collide with meshes on the scene.
Is this possible to do with jME3? If so, how would I do that? Create a mesh, attach the character sprites as textures to it?
Well since jME3 is a 3d render engine, it might work out best to attempt a 3d character model
jME3 has billboard support but the backend of actually animating the sprites is up to you. I’m working on something similar, using 3D for the environment and 2D for the characters and such, so it can definitely be done.
Well since jME3 is a 3d render engine, it might work out best to attempt a 3d character model :)
Yes, but it has 2D support as well.
Any tips for me? Can I use the Picture class for my character sprites? Or aren't they meant to interact with the 3D world? (Which shouldn't be, because they're spatials).
You use a Geometry with a single quad Mesh that you attach a BillboardControl to, then you only need the shader to change the pictures on the Quad, you might want to look at the particle effects shader for that, as it supports playing a sequence of images that are stored in one single texture. You could also use the direct-texture-painting method proposed in a snippet in the jME3 Contributon group…
I can’t see my Spatial anymore when I attach my BillboardControl.
I simply create a BillboardControl, attach it to my Spatial and set it to look at the camera, but then my Spatial becomes invisible.
Did I forget something?
You have to set it to look at the screen, not the camera
Tried it with BillboardControl.Alignment.Screen as well, but still invisible.
Is there a bug with attaching controls to spatials maybe in the current build?
I checked and everything seems to be fine.
Could you post a piece of code so we can look into it please?
m_faceScreen = new BillboardControl();
m_spriteHolder.addControl(m_faceScreen); //This is the spatial
If I remove the addControl call, the spatial is visible.
Does your m_spriteHolder lie in the plane z=0?
That was the problem, thanks.