Help Check for collision of last particle in rope - 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 Check for collision of last particle in rope (/thread-3707.html) |
Check for collision of last particle in rope - docgonzzo - 23-12-2022 Hi again, I need a way to check if the last particle in the rope (i.e. end of the rope) has collided with an object. I understand the last point in the rope can be obtained by elements but I'm not sure how to check for the actual particle. If that last particle hits an object I need to assign that object as an ObiParticleAttachment.target. Here's what I have so far.. any hints? Hoping to get this figured out before the holidays Code: void Solver_OnCollision(object sender, Obi.ObiSolver.ObiCollisionEventArgs e) RE: Check for collision of last particle in rope - josemendez - 23-12-2022 (23-12-2022, 01:43 AM)docgonzzo Wrote: I understand the last point in the rope can be obtained by elements but I'm not sure how to check for the actual particle. Hi! The last point in the rope is the last particle. Each element contains the indices of 2 particles in the solver, and each contact contains the index of 1 simplex and 1 collider. So all you've got to do is get the particle index from the simplex, and check whether it is the same as the element's: Code: void Solver_OnCollision(object sender, Obi.ObiSolver.ObiCollisionEventArgs e) See "retrieving the particle involved in a contact" in the scripting collisions section: http://obi.virtualmethodstudio.com/manual/6.3/scriptingcollisions.html kind regards, |