![]() |
Solver_OnCollision: Distinguish between Obi Types at collision - 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: Solver_OnCollision: Distinguish between Obi Types at collision (/thread-1462.html) |
Solver_OnCollision: Distinguish between Obi Types at collision - HenryChinaski - 06-11-2019 Hi, I use this code on our ObiSolver to let the player character interact with Obi SoftBodies: Code: void Solver_OnCollision(object sender, Obi.ObiSolver.ObiCollisionEventArgs e) It looks pretty much perfect in our use-case. Unfortunately, we have problems making this compatible with ObiRopes as well, because the Solver_OnCollision event does not distinguish between Obi Types. We want to have other values if the player touches soft-bodies or ropes. I initially thought that would be what the sender component is used for, but strangely a Debug.Log(sender) only returns ObiSolver(Obi.ObiSolver). Am I missing something? Could this be added as a feature? I think it is quite essential if you have both assets. Best regards and honest thanks for your always great support, Daniel RE: Solver_OnCollision: Distinguish between Obi Types at collision - josemendez - 06-11-2019 (06-11-2019, 04:30 PM)HenryChinaski Wrote: Hi, Hi, You can easily retrieve which actor a particle belongs to. See "Retrieving the actor involved in a contact" in: http://obi.virtualmethodstudio.com/tutorials/scriptingcollisions.html once you have the ObiActor (which is the base class for ObiCloth,ObiEmitter,ObiRope, etc) you can just do: Code: if (actor is ObiCloth) RE: Solver_OnCollision: Distinguish between Obi Types at collision - HenryChinaski - 06-11-2019 (06-11-2019, 06:48 PM)josemendez Wrote: Hi, Again I just didn't observe the tutorials correctly. Thanks! |