-
What's the policy on interacting with multiple physics systems from the same thread? I noticed while moving some locks around that Is there some inherent limitation with having multiple systems locked at the same time, or is it just the assert/check that's a bit heavy-handed? It's not a showstopper or anything, but I figured I should check before attempting to work around it. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
Hello, That's a good point that I didn't think about! The PhysicsSystems are completely independent of each other as long as you make sure that you don't mix bodies or constraints between them (mixing shapes should be ok). It is totally fine to lock bodies from multiple PhysicsSystems at the same time. All the thread_locals that are used for validating consistency were not made with multiple PhysicsSystems in mind and will falsely assert that you're doing something wrong. I'll have to come up with a better way of tracking the PhysicsLocks (and also BodyAccess, BodyManager::sOverride*). Note that there are a couple of globals that make the PhysicsSystems not completely independent:
But I think these are so low level that you probably wouldn't want different implementations for the different PhysicsSystems. |
Beta Was this translation helpful? Give feedback.
Hello,
That's a good point that I didn't think about! The PhysicsSystems are completely independent of each other as long as you make sure that you don't mix bodies or constraints between them (mixing shapes should be ok). It is totally fine to lock bodies from multiple PhysicsSystems at the same time. All the thread_locals that are used for validating consistency were not made with multiple PhysicsSystems in mind and will falsely assert that you're doing something wrong. I'll have to come up with a better way of tracking the PhysicsLocks (and also BodyAccess, BodyManager::sOverride*).
Note that there are a couple of globals that make the PhysicsSystems not completely independent: