0 votes


I'm using Raycast2d, and the "is_colliding()" method isn't working with my tiles.
( I followed this tutorial to make my tileset : http://docs.godotengine.org/en/stable/learning/features/2d/using_tilemaps.html )
It constatly returns me false.

However, the method does work fine when I make a replica of a tile directly in the scene, which led me to think that both the raycast and the tiles themselves are ok.
(a tile in this case being a sprite containing a staticBody2D, containing a rectangular collision shape)

Also, the collisions between my kinematic2D character and the tiles are working too.

Am I missing something or should I report this as a bug ?

Thank you in avance.

PS : I am using Godotv2.1.1-stablewin64

in Engine by (21 points)

2 Answers

0 votes
Best answer

The problem was that I didn't didn't modify the collision layers of the TileMap to match those of the tile and the collision mask the Raycast2D.

by (21 points)
0 votes

Try with the 2.1.4 beta. Several fixes for physics have been made on that release.

Also make sure you are querying the ray after the engine has got the chance of updating its state; namely, at least a fixed frame has run since it has been created or by calling force_update() (or something similar, check the docs for the exact name) on it before checking.

by (182 points)

I just tried with 2.1.4 and ended up with the same results.

The issue is not about the update either : it keeps on returning false when the raycast isn't modified for multiple seconds, and the test with the replica in the scene does give the right result.

Thank you for your time.

I think I understand your issue better now. Indeed, it's weird. Feel free to open an issue. Much better with a minimal example that reproduces the problem.

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 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 webmaster@godotengine.org with your username.