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 (21,981 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 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.