2D Animation on the GUI Layer

I’m new to JMonkeyEngine and trying to create a doom inspired shooter, but I’ve ran into a problem that I can’t figure out. I am unsure how to animate on the GUI node/layer, so I’m asking for a little help! Thanks!

Hello. As far as I know is the animation independent of the ViewPort. Get the AnimComposer control from the spatial and use setCurrentAction, like the spatial would be a child of the rootNode.

What kind of animation? What are you trying to do exactly?

I am trying to create an animation that is 2D such as the original Doom or Wolfenstein 3D. Maybe using multiple PNG’s or a GIF file.

Create a fake 3D world in the GUI node (I don’t know if that’s what you’re trying to do); Why not create a 3D game? I don’t know what you intend to do exactly.

If you use PNG files, you can change the textures of your models (Geometry) to project the desired animation.

GIF files, I’m not sure if JME3 supports them.

[NOTE]

If you want to create animations closer to 2D (or games), I suggest using the following libraries (for beginners):

You are still going to need to be more specific. Doom was a 3D game.

Do you have a screen shot of what you are trying to do?

I’m guessing that the OP maybe wants to create animated HUD elements, like the player portrait or weapons.

Sorry for the confusion but I am trying to create animated HUD elements.

The way I would do it is with a custom control and a sprite sheet:

  1. Add all the frames of your animation into a grid so all frames have the same size.

  2. Create a Quad (or a custom mesh) with your image.

  3. Create a control that updates the UV coordinates of the mesh over time. Calculate the horizontal and vertical position of the frame and translate it into the UV coordinates, write this updated coordinates into the mesh buffer.

I made this example based on some code I have, you can take a look and adapt it to your needs.

Try it and ask questions if you need more clarity in the explanation.

I recommend you to read about custom meshes to understand how the mesh buffers and UV coords work.

The more efficient way would be to make it in a shader, but I believe this is simpler and better for learning JME.

3 Likes