Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Is there a way to query collisions with Obi Bone?
#4
(06-05-2024, 03:19 PM)spikebor Wrote: With the same code, I can receive the collision events between a softbody character with a collider, but this setup can not receive the event, even though my character can contact with the Golem's Obi bone.
[...]
This means we can receive the Collisions event on the Golem which has particles, but not on the Cube which has no particle.

Hi,

Now I understand your confusion, collision callbacks don't work the way you seem to expect. See:
http://obi.virtualmethodstudio.com/manua...sions.html

Quote:Obi does not work with the default Unity collision callbacks (OnCollisionEnter,OnCollisionExit,OnCollisionStay...) because of performance and flexibility reasons. Instead, the ObiSolver component can provide a list of all contacts generated during the current frame. You can then iterate this list of contacts and perform any custom logic you need.

When you subscribe to OnCollision, you get a list of all contacts between particles and colliders in the solver. For each individual contact, you can tell the specific particle and collider involved in that contact. This allows you to process the contacts in parallel should you need to, which is a lot more efficient than having them scattered across function calls to multiple objects like Unity does, specially if you have thousands of contacts every frame.


(06-05-2024, 03:19 PM)spikebor Wrote: Can the system send the collision event to the Cube (contact receiver with no Obi particle) too? like Unity physics, the collision events send to every collider in that contact.

The system will send the collision event to whatever object(s) you subscribe to the OnCollision event. So typically you subscribe just one object (doesn't matter which one) to OnCollision, then process all contacts just once and perform whatever logic you need depending on the particle/collider involved in each contact.


kind regards,
Reply


Messages In This Thread
RE: Is there a way to query collisions with Obi Bone? - by josemendez - 06-05-2024, 04:48 PM