18-11-2021, 01:24 PM
(This post was last modified: 18-11-2021, 01:47 PM by josemendez.)
(18-11-2021, 01:00 PM)greyhawk Wrote: What am i doing wrong?
if (contact.distance < 0.01); //<----semicolon
You're placing a semicolon right after the if condition. This means the condition is empty and the code inside the brackets will always execute. Your code is equivalent to this:
Code:
if (contact.distance < 0.01)
{
}
// do this no matter what:
ObiColliderBase col = world.colliderHandles[contact.bodyB].owner;
if(col !=null)
TearRope(col, contact);
So anytime there's any contact, a rope will tear.
Removing the semicolon, it works as intended: