我有两个节点 - 兔子和平板。我怎么能让它通过彼此,以及我做错了什么?
static const uint32_t rabbitCategory = 0x1 << 1;
static const uint32_t slabCategory = 0x1 << 2;
rabbit.physicsBody.categoryBitMask = rabbitCategory;
rabbit.physicsBody.collisionBitMask = rabbitCategory;
slab.physicsBody.categoryBitMask = slabCategory;
slab.physicsBody.collisionBitMask = slabCategory;
答案 0 :(得分:2)
我相信你想将collisionBitMask
设置为物理体碰撞的类别:
rabbit.physicsBody.categoryBitMask = rabbitCategory;
rabbit.physicsBody.collisionBitMask = slabCategory;
slab.physicsBody.categoryBitMask = slabCategory;
slab.physicsBody.collisionBitMask = rabbitCategory;
答案 1 :(得分:0)
我找到了解决方案:
rabbit.physicsBody.categoryBitMask = rabbitCategory;
rabbit.physicsBody.collisionBitMask = borderCategory;
slab.physicsBody.categoryBitMask = slabCategory;
slab.physicsBody.collisionBitMask = slabCategory;