我尝试在两个节点之间建立联系,代码如下:
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 :(得分:0)
CGMutablePathRef path = CGPathCreateMutable();
就是答案。很多工作,但你必须做你必须做的事情!