Creating fold able papers in android game

Hello my friends :slight_smile:

i want to make a android game, I’m trying to make fold able paper in my game, for example i want to have a bitmap image in my sene, and be able to fold it with drags, see the idea:

1.png

can anyone give me the trick of doing so?

dont forget that i dont want to replace some sprites! i want a sprite to be folded dynamically.
thanks.

Lets see, in red picture case, you have 4 triangles to display: upper left half of picture, flipped part of papre that is dragged by finger, and 2 triangles that make remaining quad.
Because you probably want to drag that folder paper at any angle, premade shapes and animations will not work.

You either can create meshes in runtime, or use square meshes with clever and tricky masking.

For squares and masking:
First make algorithm that splits your paper in triangles. Calculate correct uvs for visible part of paper for current triangle.
Then rotate and pan uvs for material. But this all will be hacky way and probably lots of unnecessary problems

So you are really left with making custom meshes. Those are just triangles, biggest problem will be giving them correct uv coordinates.

Thanks a lot for your reply, i get the idea, but i have no knowledge about meshes an making them, so can you please give me some documentation about it, which i be able to continue my way?

here simple search gave this: