Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  (5.3) ObiCloth passes through colliders when instantiated as prefab
#3
(23-06-2020, 10:42 AM)josemendez Wrote: 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):

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.

Thank you for the quick response! I'll give that a try today and provide an update here.
Reply


Messages In This Thread
RE: (5.3) ObiCloth passes through colliders when instantiated as prefab - by caldorf - 23-06-2020, 05:38 PM