Obi Official Forum

Full Version: Add vector and script when hit collider.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Can I add vector and script to obi tearable cloth when it hit somthing collider(box, sphere or mesh)?
(13-03-2019, 09:54 AM)Richard Wrote: [ -> ]Can I add vector and script to obi tearable cloth when it hit somthing collider(box, sphere or mesh)?

Yes, use collision callbacks:
http://obi.virtualmethodstudio.com/tutor...sions.html
The page is written about setting of obi cloth, but do I not have to set up collider the cloth would collide with? Just add obi collider?
(14-03-2019, 11:29 AM)Richard Wrote: [ -> ]The page is written about setting of obi cloth, but do I not have to set up collider the cloth would collide with? Just add obi collider?

Not sure I understand your question. Adding a ObiCollider component to any existing collider allows it to interact with Obi actors. That's it, you don't need any additional set up. See: http://obi.virtualmethodstudio.com/tutor...sions.html

Then, if you need to detect which solver particles have collided with a collider, you subscribe to the solver's OnCollision event (as described i the link I provided).
(14-03-2019, 12:52 PM)josemendez Wrote: [ -> ]Not sure I understand your question. Adding a ObiCollider component to any existing collider allows it to interact with Obi actors. That's it, you don't need any additional set up. See: http://obi.virtualmethodstudio.com/tutor...sions.html

Then, if you need to detect which solver particles have collided with a collider, you subscribe to the solver's OnCollision event (as described i the link I provided).

I could do that.

Can I attach script or component without colliding? For example, particles that are in (or enter) the box(or in the area) gain script or component.
(14-03-2019, 04:10 PM)Richard Wrote: [ -> ]I could do that.

Can I attach script or component without colliding? For example, particles that are in (or enter) the box(or in the area) gain script or component.

Hi,

I think you want to use a trigger (built-in Unity stuff). Simply enable the "IsTrigger" checkbox of your collider. It will detect particles entering it, but won't generate collisions. See:
https://docs.unity3d.com/Manual/CollidersOverview.html
(14-03-2019, 05:49 PM)josemendez Wrote: [ -> ]Hi,

I think you want to use a trigger (built-in Unity stuff). Simply enable the "IsTrigger" checkbox of your collider. It will detect particles entering it, but won't generate collisions. See:
https://docs.unity3d.com/Manual/CollidersOverview.html

Hello.

How can I fix:
NullReferenceException: Object reference not set to an instance of an object
Obi.ObiCloth.AddToSolver (System.Object info) (at Assets/Obi/Scripts/Actors/ObiCloth.cs:167)
Obi.ObiActor.Start () (at Assets/Obi/Scripts/Actors/ObiActor.cs:163)
?
(15-03-2019, 11:48 AM)Richard Wrote: [ -> ]Hello.

How can I fix:
NullReferenceException: Object reference not set to an instance of an object
Obi.ObiCloth.AddToSolver (System.Object info) (at Assets/Obi/Scripts/Actors/ObiCloth.cs:167)
Obi.ObiActor.Start () (at Assets/Obi/Scripts/Actors/ObiActor.cs:163)
?

Hi,

This should only happen if you set the solver to null programmatically, then call AddToSolver(). Can you describe what you're doing?
(15-03-2019, 04:42 PM)josemendez Wrote: [ -> ]Hi,

This should only happen if you set the solver to null programmatically, then call AddToSolver(). Can you describe what you're doing?
I am trying to put pants on human. I would like to fasten pants like rubber of clothing. However, it is hard to pick up particle on script. I use trigger.