Page 1 of 1

[V1] Atomic operations?

Posted: Mon Aug 20, 2018 10:55 am
by roro56
Hi there again :D

I have some doubts about body management in space. I mean I have a simulation working in a separate thread. In the main thread I can add bodies in space or remove them via space's SpaceObjectBuffer. But what if I want to do some atomic operation? I want to add/remove several bodies. How can I garantie that the next simulation update takes into account the whole of that changes or nothing of them? Is it my job or bepu can do it for me automatically?

Re: [V1] Atomic operations?

Posted: Mon Aug 20, 2018 10:14 pm
by Norbo
There's no good built in solution for more complex logic like that, so I would recommend just creating your own buffered change queue that you can flush on the physics thread. The SpaceObjectBuffer is nothing special anyway- v2 doesn't even have an analogous feature since it is so low value.