https://docs.unity3d.com/Packages/com.unity.physics@1.0/manual/group-body.html
If I understand this correctly I need to define physics worlds (physics groups to be exact) in code.
For my project it would be great if I could create and remove these worlds at runtime when they are needed. All of them would be exactly the same with the same systems, I just don't want them to interact with each other.
Is there a way to do it or is my only option defining some fixed amount of them in code beforehand?
That's assuming my understanding on how it works is correct in the first place.
#Can I create physics worlds dynamically at runtime?
1 messages · Page 1 of 1 (latest)
to avoid XY problem, just explain what you want in the first place
Can I create physics worlds dynamically at runtime?
Right my post was supposed to be plural. I need to run multiple, dynamically added or removed, physics "simulations" in the same world space but without them interacting with each other. The link I posted expains that I can create separate Physics Worlds (by creating physics system groups) before starting the game but I would like to know if I can create and remove these at runtime
simply set different world index component
PhysicsWorldIndex
each physics world index runs in different simulation
Yeah thats how I make entity run in that separate physics world but do I need to create one first?
Create the physics world...
simply have a single physics entity with PhysicsWorldIndex
I know you're trying to help but did you even read the question or the title or any of my messages?
I know how to move entities between physics worlds
My question is, like title says, if I can create these physics worlds dynamically at runtime instead of having to do it before compiling/building the game
If I just change the index to 1 it doesn't work
It does when I create customPhysicsGroup with index of 1 like this link says
But I don't want to do that, I want to create and destroy these physics worlds / groups at runtime