Fold Effect? for a poker card

Dear People,

I am new to jME - coming from Java3D - and I need to provide the fold effect to a poker card (one corner). I do load the poker card from an OBJ with its texture and that works fine. Now I need to provide this effect, but as too recent to jME I am, I havent found yet a good resource to check this kind of effect I need to provide.

Any idea, sample, about how to manage this fold effect?

Thank you, very much, in advance.

Manu  :wink:

One way would be to access the TriMesh in the model once is loaded, and calculate the folding line and then with some 3D Math you could figure out the positions of the vertexes forming the folding region… Since I love math, that is what I would do, but you would probably be better off just animating it in a 3D modeling tool (like blender) and then just import the model with the animation embedded.

Good luck

Hi, duenez,

I love spatial maths, but I have no much time… anyway, I would try it. To start with it would you mind guiding me, with a little dummy-sample, how do I modify a bit the TriMesh? that's what I need to learn first, before applying any kind of effect.

Note that I do have an OBJ with its texture loaded, which means I need to upgrade both when manipulating the TriMesh. Is this automatically done when modifying the TriMesh?

Thanks a lot!

Manu  :wink:

The idea is to obtain the batches of the TriMesh… I will assume your model only has one:

TriMesh tm; //initialize it as desired.
TriangleBatch gb = tm.getGatch(0);
FloatBuffer verts = gb.getVertexBuffer();
IntBuffer indx = gb.getIndexBuffer();

Now, in verts you have the "array" of vertices, and in indx the indices over those vertices that form the mesh... (each 3 indices represent a point, each 3 points represent a triangle). If you change these values, and call tm.updateGeometricState(), your mesh will reflect those changes. (Textures need not to be modified).