set_pos() and collision detection

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By websterek
:warning: Old Version Published before Godot 3 was released.

Hi, I have situation like on this picture:

This white “walls” are moving down using set_pos(). All of them are generated from script with correct KinematicBody2D and CollisionPolygon2D. Similar situation is with that arrow on the bottom (but it can move only left and right). How can I detect collision?

get_node(“arrow”).is_colliding() giving me back “false”.

:bust_in_silhouette: Reply From: JTJonny

I think is sounds like you are trying to push two physics objects through each other. You might want to adjust the moving walls physics layer/mask to ignore collision with the floor, but not with the player.

also, if you want to use is_colliding(), it needs to be in a func _fixed_process().

Some resources that might make things clearer:
http://docs.godotengine.org/en/latest/tutorials/2d/physics_introduction.html
http://www.gamefromscratch.com/post/2015/03/19/Godot-Engine-Tutorial-Part-7-Physics-and-Collision-Detection.aspx
(video version: https://youtu.be/QQ3y9YU_QAo)

Also, collision tutorial: https://github.com/Kermer/Godot/wiki/tut_simple-collision

ericdl | 2016-06-23 18:53

Thanks for help :slight_smile:

Finally i have created 2D area with signal “area_enter” and it’s works fine.

websterek | 2016-06-28 11:28