Help Creating a list of all gameobjects currently in contact with ObiRope - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html) +--- Thread: Help Creating a list of all gameobjects currently in contact with ObiRope (/thread-3152.html) |
Creating a list of all gameobjects currently in contact with ObiRope - Faffy_Waffles - 27-10-2021 As the title says, I would like to be able to find all objects currently colliding with the obirope. I'm sure I could figure it out myself with a bit of time, but I'd figure I'd ask before making something that might already exist within the asset. Also, I just wanted to say that this asset rules, absolutely the bomb dot com 5 stars RE: Creating a list of all gameobjects currently in contact with ObiRope - josemendez - 27-10-2021 (27-10-2021, 04:47 AM)Faffy_Waffles Wrote: As the title says, I would like to be able to find all objects currently colliding with the obirope. I'm sure I could figure it out myself with a bit of time, but I'd figure I'd ask before making something that might already exist within the asset. Hi there! Thanks for your kind words You can do this using collision callbacks: http://obi.virtualmethodstudio.com/manual/6.2/scriptingcollisions.html You subscribe to the solver's OnCollision event, and then iterate trough all contacts generated by the solver. You get a lot of information about each contact, including the specific particle and collider component involved in it. See "Retrieving the collider involved in a contact" in the link above for some code that retrieves the collider for a given contact. Also, the first code snippet in "Some examples" does basically what you need, you can just copy-paste it. let me know if I can be of further help. |