Ios7 如何在另一个SKPhysicsBody对象中实现SKPhysicsBody对象?

Ios7 如何在另一个SKPhysicsBody对象中实现SKPhysicsBody对象?,ios7,sprite-kit,game-physics,skphysicsbody,Ios7,Sprite Kit,Game Physics,Skphysicsbody,场景是:一个玩家和一个盒子,玩家在盒子里。当我在屏幕上向右滑动时,播放器向右运行。当他到达箱子的右边缘时,他会把箱子推到右边 所以我设计了两个节点 CGRect-box=CGRectMake(110270100100); SKShapeNode*shapeNode=[[SKShapeNode alloc]init]; shapeNode.path=[UIBezierPath-bezierpath-withrect:box].CGPath; shapeNode.physicsBody=[SKPhy

场景是:一个玩家和一个盒子,玩家在盒子里。当我在屏幕上向右滑动时,播放器向右运行。当他到达箱子的右边缘时,他会把箱子推到右边

所以我设计了两个节点

CGRect-box=CGRectMake(110270100100);
SKShapeNode*shapeNode=[[SKShapeNode alloc]init];
shapeNode.path=[UIBezierPath-bezierpath-withrect:box].CGPath;
shapeNode.physicsBody=[SKPhysicsBody WithPolygonFromPath:shapeNode.path];
shapeNode.physicsBody.dynamic=否;
shapeNode.physicsBody.categoryBitMask=kbox;
shapeNode.physicsBody.collisionBitMask=1;
shapeNode.physicsBody.contactTestBitMask=kplayer;
[self addChild:shapeNode];
SKSpriteNode*player=[SKSpriteNode spriteNodeWithColor:[UIColor whiteColor]大小:CGSizeMake(10,30)];
player.physicsBody=[SKPhysicsBody和矩形大小:player.size];
player.physicsBody.categoryBitMask=kplayer;
player.physicsBody.collisionBitMask=1;
player.physicsBody.contactTestBitMask=kbox;
player.position=CGPointMake(self.size.width/2,self.size.height/2);
[自我添加孩子:玩家];

上面的初始代码不起作用,shapeNode不能与播放器冲突。如何在另一个SKPhysicsBody对象中实现SKPhysicsBody对象?我该如何实现我的想法?多谢各位

您可以将子节点添加到方框的(in)侧,并检查播放器与内部节点之间的接触。建立联系人后,只要已注册联系人,就可以手动移动父项(框)。您可以使用类似于
box.position=CGPointMake(box.position.x,box.position.y+1)的方式移动长方体。这将在
更新:
方法中完成。

尝试使用
shapeNode.physicsBody=[SKPhysicsBody-body-withedgeloopfromrect:box]@akashg我试过了,但没用。