0 votes

Is there an example of move_and_collide() test?
What it returns when colides and how to treat its return?

I'm trying to implement a change on the generated path if the test shows that is colliding at some point...

in Engine by (43 points)

1 Answer

0 votes
Best answer

There's an example here: Using KinematicBody2D. If it returns a value, there was a collision.

The returned value of move_and_collide() is a KinematicCollision2D. You can see the list of data it contains on the API page.

by (20,893 points)
selected by

I'm carefully reading the tutorial and watching your videos (and all other sources that I can get), but I'm really got stuck at this point.
My goal is to get the NPCs to detect if there is an obstacle between it and the next position on the pathfollow. If positive, they need to contour it then keep walking through the path.
I'm not with much luck in this... This is what I did 'till now: project on Github

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.