Find all intersection points with the cutting line.
Split vertices into two sets divided by the cutting line.
Add intersection point to both sets.
Use the gift wrapping algorithm to find new edges.
Use any meshing algorithm to generate new geometry.
Create new sprites with that geometry.
There is also an edge case where the cutting line directly hits a vertex. You need to handle that. Also it is a good idea to force minimum length of sprite edges otherwise it can produce nasty meshes.
This algorithm only works for convex meshes and full cuts. For concave geometry it's a lot more complicated.
← Return to game
Comments
Log in with itch.io to leave a comment.
hello! It's a nice game! And I am a Games Design student, could you tell me how to split a Sprite in two?
Sure.
There is also an edge case where the cutting line directly hits a vertex. You need to handle that. Also it is a good idea to force minimum length of sprite edges otherwise it can produce nasty meshes.
This algorithm only works for convex meshes and full cuts. For concave geometry it's a lot more complicated.
Thanks a lot, I'll try to achieve it.