I want to simplify #pymunk + #py5 use for my students but I struggle with finding good strategies… Pymunk has two types of (linked) objects for each simulated object: body and shape. For complex objects (like concave shapes) you can use more than one convex shape linked to the same body. In these cases I usually want to have an extra shape to draw and hide the triangulation.
I don’t want to keep extra data structures to track the simulation objects to draw. I tried both extending and monkey patching either body or shape objects to be “drawable” so I can just iterate the native pymunk structures and ask stuff to draw themselves (would be nice, huh?), but there is always some snag. If I extend shape classes, I stumble on the complex objects with many shapes drawn with divisions. If I extend the Body class, the problem is static objects have shapes but share a virtual constant body, more of a flag, so I can’t add anything to it, so back to keeping track of a separate list of static shapes… Then performance & serialization issues, I want to be able to easily pickle simulations, but if I add Py5Shape objects to the extended/modified classes they become unpickable…
I have bigger fishes to fry right now (the paralyzing PhD) but this is something I would like to pair with someone more experienced to work on.