Help Collision works buggy - 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 Collision works buggy (/thread-2919.html) |
Collision works buggy - boulder - 11-05-2021 Hi, I have some problems with collisions. I am using the code below for each collision to get the touching each other rope but it gives wrong/inconsistent data. Here each rope touching each other should be having darker tone. I tried different settings and it did not change. Ropes are in the same z-axis and they definitely touch as I checked from different angles. Surface collision is open, all works as expected, I am using the latest 6.0.1 version. Here is a video : Video Do anyone having the same issue who can help me? Thanks! Code: using UnityEngine; RE: Collision works buggy - josemendez - 11-05-2021 Hi there, Your code is incorrect: you're using contact.bodyA and bodyB as if they were particle indices, but they're simplex indices. This will result in pretty much random results, or even out of bounds array access exceptions. See the docs: http://obi.virtualmethodstudio.com/tutorials/scriptingcollisions.html Specifically, the "Retrieving the particle involved in a contact" section. Let me know if you need further help. cheers! RE: Collision works buggy - boulder - 11-05-2021 Himm I tried everything on that side before and today as well. I couldn't find a stable way to get if two different ropes are touching each other. I got a lot of same rope touching itself but not stably each other. I started to sort all simplices in scene and comparing distances but it needs huge processing power. Could you please give me a simple pseudo code to get if ropes touching each other and which. So that I will know what to fiddle with? Thanks RE: Collision works buggy - josemendez - 12-05-2021 There's code for this in the above link to the manual, that you can just copypaste. Retrieve the actor for each simplex: Code: // retrieve the offset and size of the simplex in the solver.simplices array: You do this for both contact.bodyA and contact.bodyB, then compare their respective actors to see if they're the same or not. There's nothing more to it. Let me know if you need further help. cheers! |