![]() |
Collision Between 2 SoftBody - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Softbody (https://obi.virtualmethodstudio.com/forum/forum-12.html) +--- Thread: Collision Between 2 SoftBody (/thread-3164.html) |
Collision Between 2 SoftBody - dinhtai1104 - 04-11-2021 Hi devs, I've just implemented Obi Softbody plugin in game. And I don't know how to detect 2 softbody in scene (With others object is not softbody it's work perfect) here is my scripts for object softbody: Code: using System.Collections; RE: Collision Between 2 SoftBody - josemendez - 04-11-2021 Hi, Subscribe to OnParticleCollision instead of OnCollision. See the manual: http://obi.virtualmethodstudio.com/manual/6.2/scriptingcollisions.html Quote:To request the simplex-collider contact list from the solver, subscribe to its OnCollision event. To retrieve the simplex-simplex contact list, subscribe to its OnParticleCollision event. RE: Collision Between 2 SoftBody - dinhtai1104 - 04-11-2021 (04-11-2021, 10:34 AM)josemendez Wrote: Hi,Fast reply, thanks (04-11-2021, 10:34 AM)josemendez Wrote: Hi,Can you show me a sample about it, I change OnCollision to OnParticleCollision but it appears some error at line Code: var col = world.colliderHandles[contact.bodyB].owner; Quote:ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. RE: Collision Between 2 SoftBody - josemendez - 16-04-2025 (04-11-2021, 10:35 AM)dinhtai1104 Wrote: Fast reply, thanks Hi! OnParticleCollision returns collisions between particles. You're trying to access the colliders array using the index of a simplex (which doesn't make sense) so you're getting an index out of range error since there's more simplices than colliders in the scene. Instead, use solver.particleToActor to find the actor that the particle belongs to. See the manual for a detailed explanation and code examples: https://obi.virtualmethodstudio.com/manual/7.0/scriptingcollisions.html kind regards, |