2016-02-03 81 views
0

我嘗試使這兩個節點和所述代碼之間的接觸SKPhysicsBody接觸低於:與SKSpriteNode

SKTexture *bgTexttureRiverLeft = [SKTexture textureWithImageNamed:@"River_Left_Main"]; 
bgTexttureRiverLeft.filteringMode = SKTextureFilteringNearest; 
SKSpriteNode *spriteRiverLeft = [SKSpriteNode spriteNodeWithTexture:bgTexttureRiverLeft]; 
spriteRiverLeft.texture.filteringMode = SKTextureFilteringNearest; 
spriteRiverLeft.anchorPoint = CGPointZero; 
spriteRiverLeft.position = CGPointZero; 
spriteRiverLeft.zPosition = -10; 
spriteRiverLeft.name = @"River_Left_Main"; 


spriteRiverLeft.size = CGSizeMake(spriteRiverLeft01.size.width *0.8, _screenSize.height); 

spriteRiverLeft.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:CGSizeMake(spriteRiverLeft.size.width*1.85, spriteRiverLeft.size.height*2)]; 
spriteRiverLeft.physicsBody.categoryBitMask = river_left_Category; 
spriteRiverLeft.physicsBody.collisionBitMask = kajakCategory; 
spriteRiverLeft.physicsBody.contactTestBitMask = kajakCategory ; 
spriteRiverLeft.physicsBody.dynamic = YES; 
spriteRiverLeft.physicsBody.allowsRotation = YES; 

[self addChild:spriteRiverLeft]; 

由於SKTexture River_Left_Main是不在一條直線上(加捻河流),皮艇和邊緣之間的接觸河是完美的一些地方,並不是完美的另一個地方(太晚或太早)。

我的問題是如何使接觸更精確?先謝謝你。

回答

0

CGMutablePathRef path = CGPathCreateMutable();

就是答案。很多工作,但你必須做你必須做的!