The Sprite Kit "didBeginContact" function is not very accurate. What should I do?

Ok, here's the deal: I am developing a two-dimensional car game (similar to Hill Climb Racing) in the Sprite Kit for iOS. I am currently working on dust particles that appear every time the tire touches the surface on which this effect is assigned. To do this, I obviously need the "didBeginContact" and "didEndContact" functions, so that I can turn on / off the effect depending on whether the bus touches the ground or not. Here is what I want to do:

/* ---- very dirty pseudocode ---- */

didBeginContact {
    if (contact.bodyA is one of the wheels &&
        contact.bodyB is the surface that should make a dust effect) {
        engage dust effect
    }
}

didEndContact {
    if (contact.bodyA is one of the wheels &&
        contact.bodyB is the surface that should make a dust effect) {
        disable the dust effect
    }
}

. : (, -, ), , , , , , . , Sprite Kit , , - . :

leftWheel.physicsBody.usesPreciseCollisionDetection   = YES;
rightWheel.physicsBody.usesPreciseCollisionDetection  = YES;

. Sprite Kit - , .

? , Sprite Kit , . , , , , . ? !

,

, . !

+4
1
+4

Source: https://habr.com/ru/post/1539373/


All Articles