25-03-2022, 07:57 PM
I want to find out objects which a softbody ball hits at the same time.
Help please help
|
25-03-2022, 07:57 PM
I want to find out objects which a softbody ball hits at the same time.
26-03-2022, 12:03 AM
(This post was last modified: 26-03-2022, 12:03 AM by josemendez.)
(25-03-2022, 07:57 PM)Alikemalerdem Wrote: I want to find out objects which a softbody ball hits at the same time. Hi there, You can get a list of all contacts between particles and colliders by subcribing to the solver.OnCollision event. See: http://obi.virtualmethodstudio.com/manua...sions.html
26-03-2022, 08:17 AM
(This post was last modified: 26-03-2022, 08:20 AM by Alikemalerdem.)
(26-03-2022, 12:03 AM)josemendez Wrote: Hi there,I think the information I was looking for is not available at this address. Can you explain it to me? i.e. how do I get all the objects that hit the object?
26-03-2022, 12:08 PM
(26-03-2022, 08:17 AM)Alikemalerdem Wrote: I think the information I was looking for is not available at this address. Can you explain it to me? i.e. how do I get all the objects that hit the object? Hi, That page I linked to explains how to get all contacts between objects, and how to retrieve the pair of objects involved in each contact. This is what you are asking for, I believe. See “Retrieving the collider involved in a contact” and “Retrieving the actor involved in a contact” in that page. Kind regards,
26-03-2022, 03:22 PM
Code: using UnityEngine;
26-03-2022, 07:05 PM
(This post was last modified: 27-03-2022, 12:22 AM by josemendez.)
(26-03-2022, 03:22 PM)Alikemalerdem Wrote: here collision object takes only one value but I want to get all the objects that hit the object. Hi, This is a for loop over all contacts. It will get you all the object/softbody collision pairs in the solver. As a side note, this line of code doesn’t make any sense to me: Code: collision=gameObject.Find(col.name); “col” is a component on the collider gameobject, so no need to find it by name in the entire scene. You already have a reference to it, so just do Code: collision = col.gameObject; If you’re unfamiliar with C# scripting, my advice would be to learn the basics first before using Obi, as it assumes you have intermediate programming skills. Otherwise you will find it very hard and confusing to use. Kind regards,
27-03-2022, 04:12 PM
Thanks problem is solved.
|
« Next Oldest | Next Newest »
|