Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
erincatto committed May 31, 2024
1 parent 0477b48 commit f18303b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/contact.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ static bool b2TestShapeOverlap(const b2Shape* shapeA, b2Transform xfA, const b2S
return output.distance < 10.0f * FLT_EPSILON;
}

// Update the contact manifold and touching status.
// Update the contact manifold and touching status. Also updates sensor overlap.
// Note: do not assume the shape AABBs are overlapping or are valid.
bool b2UpdateContact(b2World* world, b2ContactSim* contactSim, b2Shape* shapeA, b2Transform transformA, b2Vec2 centerOffsetA,
b2Shape* shapeB, b2Transform transformB, b2Vec2 centerOffsetB)
Expand Down
3 changes: 2 additions & 1 deletion src/contact.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ typedef struct b2World b2World;

enum b2ContactFlags
{
// Set when the non-sensor shapes are touching.
// Set when the solid shapes are touching.
b2_contactTouchingFlag = 0x00000001,

// Contact has a hit event
Expand All @@ -23,6 +23,7 @@ enum b2ContactFlags
b2_contactSensorFlag = 0x0000004,

// Set when a sensor is touching
// todo this is not used, perhaps have b2Body_GetSensorContactData()
b2_contactSensorTouchingFlag = 0x00000008,

// This contact wants sensor events
Expand Down
5 changes: 2 additions & 3 deletions src/world.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +343,11 @@ static void b2CollideTask(int startIndex, int endIndex, uint32_t threadIndex, vo
b2Vec2 centerOffsetA = b2RotateVector(transformA.q, bodySimA->localCenter);
b2Vec2 centerOffsetB = b2RotateVector(transformB.q, bodySimB->localCenter);

// This updates solid contacts and sensors
bool touching =
b2UpdateContact(world, contactSim, shapeA, transformA, centerOffsetA, shapeB, transformB, centerOffsetB);

// Move

// State changes that affect island connectivity
// State changes that affect island connectivity. Also contact and sensor events.
if (touching == true && wasTouching == false)
{
contactSim->simFlags |= b2_simStartedTouching;
Expand Down

0 comments on commit f18303b

Please sign in to comment.