0 votes

I'm using code to send out a raycast, and for the life of me, I can't figure out why it will or won't detect this tilemap I have.

So in the Inspector window of my TileMap, I have bits 0 (value 1) and 1 (value 2) checked, for a total of value 3. I used space.intersect_ray from another body, and set the 4th argument (the layer mask) to 3. It detects. Great!

That's how I understood it was supposed to work anyway. But then it lost me.

I decided to see what would happen if I changed the value of that layer mask argument in the code. No changes were made to the bit values of the tilemap. The result was that it would detect no matter what number I entered unless it was a multiple of 4.

I tried again, but this time I changed it so the tilemap only had bit 1 checked (value 2). And the result was that it would detect/skip every two numbers starting with 2.
Meaning it...
doesn't detect: 1, 4, 5, 8, 9, etc.
detects: 2, 3, 6, 7, 10, 11, etc.

What is going on here? I thought that the layer mask had to equal the value of the object collision layer to detect, and wouldn't otherwise.

Am I misunderstanding how this entire thing works?

I'm using Godot 2.2 alpha, if that matters.

in Engine by (23 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.