0 votes

My raycast node returns the same object it collided with last when it's not colliding with anything. Is there any solution I can use? Am I missing something?

in Engine by (150 points)

Difficult to help if you don't show the example scene and the script to check the collision.

I moved answer to comment because it's actually not an answer.

As this document says, http://docs.godotengine.org/en/latest/classes/class_raycast.html
RayCast.get_collider() just returns only one Object

According to https://github.com/godotengine/godot/blob/3a70d4a072fa170ae927e2b416861ccd395f92d2/servers/physics/space_sw.cpp#L50-L138
yes, it just try to find last colliding object and return it.

This can be fixed somehow, but it will break compatibility.
I suggest you to report this issue on github.
https://github.com/godotengine/godot/issues
Probably, it could be fixed in Godot 3.0

1 Answer

0 votes

yes return object collided with raycast all fine

by (101 points)
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.