23-06-2020, 10:42 AM
(This post was last modified: 23-06-2020, 10:45 AM by josemendez.)
Hi there!
Collider geometry might not be updating, if they're instantiated while disabled. As you know, Obi uses the ObiCollider wrapper component to make Unity's collider data available to the particle system. ObiCollider updates this data whenever Unity's transform.changed is set to true. That could explain why the colliders do not "wake up" after being instantiated trough code, but do when dragged into the scene.
To know the exact cause of this, I would have to go over your code and see where the container prefabs are being instantiated/moved in relation to the physics update cycle. A quick fix would be slightly modifying ObiColliderBase.cs, make the "dirty" protected variable public, and then set it to true when you want to force a refresh (probably right after instantiating the prefab):
The collider will be updated in the next physics step no matter what, and the "dirty" flag set automatically back to false.
Let me know if this solves the issue!
Also, in upcoming versions we've ditched this "dirty" flag. Instead, colliders are always checked for changes (in parallel) and then updated only if a change has been detected.
Collider geometry might not be updating, if they're instantiated while disabled. As you know, Obi uses the ObiCollider wrapper component to make Unity's collider data available to the particle system. ObiCollider updates this data whenever Unity's transform.changed is set to true. That could explain why the colliders do not "wake up" after being instantiated trough code, but do when dragged into the scene.
To know the exact cause of this, I would have to go over your code and see where the container prefabs are being instantiated/moved in relation to the physics update cycle. A quick fix would be slightly modifying ObiColliderBase.cs, make the "dirty" protected variable public, and then set it to true when you want to force a refresh (probably right after instantiating the prefab):
Code:
obiCollider.dirty = true;
The collider will be updated in the next physics step no matter what, and the "dirty" flag set automatically back to false.
Let me know if this solves the issue!
Also, in upcoming versions we've ditched this "dirty" flag. Instead, colliders are always checked for changes (in parallel) and then updated only if a change has been detected.