How is it possible that a SpriteKit dynamic body can pass through StaticBody?

Hi, I get a weird effect in my game SpriteKit.

I have a wall around the screen that I created staticbodyusing bodyWithEdgeLoopFromRect.

Performing skView.showsPhysics = YES;, all bodies are also displayed on the screen.

I have a ball in the screen. Which has dynamic body. sometime when I provide a Forceball it misses this static wall !!!

How is this possible?

Although I can see both bodies on the screen, a dynamic ball once passes through a static wall.

I also gave a property usesPreciseCollisionDetection = YES;for both physics bodies. But this does not interfere with this problem.

How can I prevent this problem?

+4
source share
1

, . , X + 300 , , , "" .

usesPreciseCollisionDetection YES , .

. - :

if(self.physicsBody.velocity.dx > 100)
    self.physicsBody.velocity = CGVectorMake(100, self.physicsBody.velocity.dy);

100, dy ( ) .

+1

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


All Articles