Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Oncollision detection and cut rope problem
#7
(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:
Reply


Messages In This Thread
RE: Oncollision detection and cut rope problem - by josemendez - 18-11-2021, 01:24 PM