0
votes

cocos2d v3 & Chipmunk ...

How would I specify that a chipmunk physics body be affected by gravity only but ignore all other physics objects? i.e. other object don't affect its movement or collide with the body

I tried using collisions categories and masks (with no other objects specified) as such but I'm still getting collisions.

objOnlyGravity.physicsBody.collisionType = @"objOnlyGravityType";
objOnlyGravity.physicsBody.collisionCategories = @[@"objOnlyGravityCat"];
objOnlyGravity.physicsBody.collisionMask = @[@""]; ///  <- I assume putting nothing here would have it ignore all collisions
1

1 Answers

4
votes

Setting your physicsBody as a sensor will do for your use case :

objOnlyGravity.physicsBody.sensor = YES;

This means that the collisions will be detected by your objects and you can have access to them via callbacks, but they will not actually interact.