0 votes

I have ready the get_slide_collision example at https://docs.godotengine.org/en/stable/classes/class_kinematicbody2d.html#class-kinematicbody2d-method-get-slide-collision
but I am unsure of how to implement it into my script.

in Engine by (298 points)
edited by

1 Answer

0 votes

Perhaps this will do it:

for i in get_slide_count():
        var collision = get_slide_collision(i)
        if collision.collider.name == "Player":
               DoSomething

Change "Player" to what your player node name is and tell me if it does what you want!

by (23 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.