Dieblitzen
Dieblitzen

Reputation: 544

Does the usePreciseCollisionDetection property work when the physics body does not have a collisionBitMask

I do not want my physics bodies to collide when they come in contact, but I want to use the physicsBody?.usesPreciseCollisionDetection = true so that it detects contacts between the two bodies more accurately. So if I set

 physicsBody?.collisionBitMask = PhysicsCategory.None //Assume that PhysicsCategory is an Enum and .None means that the bit mask is set to 0 or nothing
 physicsBody?.usesPreciseCollisionDetection = true

Will the usesPreciseCollisionDetection still be valid? And if not, how to I implement more precise contact testing? Thanks

Upvotes: 2

Views: 404

Answers (1)

hamobi
hamobi

Reputation: 8130

you usually need usesPreciseCollisionDetection to make sure that a fast moving object isnt passing through a set of tiles or other physics objects that are pressed together. if youre just using the physics object as a sensor (just to test for collisions) then you probably dont need to use that. I would guess that it works either way since the documentation doesnt say otherwise, but i dont think theres any way to know for sure..

EDIT: It does matter.. if you want to detect fast moving objects set usesPreciseCollisionDetection to true. You need it whether you have a collisionbitmask set or not. Thanks Whirlwind!

Upvotes: 1

Related Questions