pymunk icon indicating copy to clipboard operation
pymunk copied to clipboard

Copy only dynamic data

Open majklost opened this issue 4 months ago • 3 comments

I am using pymunk for my bachelor thesis, where I plan using RRT algorithm. Problem is, that I store many copies of space in a tree. I benchmarked my solution and found out that making a copy of space is the most expensive operation in whole process (70 % of time). Since all the simulations contain same bodies, constraints, shapes and collision handlers, I would just need to extract and apply only data that changes when stepping the simulation.

I tried to copy all physical aspects of bodies to bodies in second simulator (pos, velocity, angle,...), But simulation result still differs.... I looked how space.copy() is implemented, but it creates new space, so many things differs from my usecase.

Can you give a hint what all should I export and import from one simulation to another to achieve same behaviour when stepping both of them? (I can then contribute this feature to pymunk if it works) Thanks, Michal

majklost avatar Oct 01 '24 19:10 majklost