Obi Official Forum
Detect Collider - 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: Detect Collider (/thread-2510.html)



Detect Collider - yetkintmn - 25-09-2020

Hello everyone, I haven't done anything I want to do on Unity:
I could not find how to use this code with Soft Body without using colliders. In Unity, ready colliders (boxes, sphere) do not sit properly on the object.


private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.tag == "Glass")
        {
            CreateLittleWaters();
            Destroy(gameObject);
        }
        else if (collision.gameObject.tag == "Floor")
        {
            Destroy(gameObject);
        }
    }



RE: Detect Collider - josemendez - 25-09-2020

Hi,

Obi is a separate physics engine, so it does not use Unity's collision callbacks but its own. See the manual:
http://obi.virtualmethodstudio.com/tutorials/scriptingcollisions.html


RE: Detect Collider - yetkintmn - 25-09-2020

yes, I tried it, but I am having a problem with how to adapt the code there to the code I wrote myself.


RE: Detect Collider - josemendez - 25-09-2020

Could you elaborate on that?


RE: Detect Collider - yetkintmn - 25-09-2020

I want to know if an object hits another object. If unity's ready colliders can't work properly, I can't check it with the OnCollisionEnter method. How can I do this check using Obi SoftBody.

ObiColliderWorld gives an error.
My Unity version is 2020.1.5, VS is 2019



RE: Detect Collider - josemendez - 25-09-2020

Hi,

There's a full example of doing this in the manual, that you can copy-paste. You should subscribe to the solver's OnCollision event, and then iterate over the contacts looking for whatever colliders you need.

ObiColliderWorld should not give any errors, unless you're using Obi 4.X. Can you post the errors you're getting?


RE: Detect Collider - yetkintmn - 25-09-2020

Obi SoftBody version is 5.1

Added attachment that is screenshare. But I guess the SS is not visible Triste


RE: Detect Collider - josemendez - 25-09-2020

You should update to Obi 5.6. There's many bug fixes and performance improvements since 5.1.

If you're using 5.1, see this page instead:
http://obi.virtualmethodstudio.com/tutorials_4/scriptingcollisions.html

There's no attachment to your last post. Just try posting a link to your image.