Godot 3.0 Alpha1 - How to check collision on a KinematicBody2D?

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

Well, I’m testing Godot 3.0 Alpha1 and noticed that the method “is_colliding()” is gone for good from KinematicBody2D.

Is there any way to check this collision?

I’ve already tried the following (new) methods:

“is_on_ceiling()”
“is_on_floor()”
“is_on_wall()”
“get_collision_count()” (expecting it would return me a number bigger than 0)

In advance, thank you!

I also need to know if this is valid:

Dictionary move ( Vector2 rel_vec )
Move the body in the given direction, stopping if there is an obstacle. If as a result of a movement there will be any collision then informations about this collision will be in returned dictionary. Dictionary will contains those keys:

“position” - collision position
“normal” - collision normal
“local_shape” - id of this kinematic body shape that took part in a collision
“travel” - traveled movement before being stopped
“remainder” - remaining movement before being stopped
“collider_id” - id of the collider, it can be used when dealing with Physics2DServer
“collider” - colliding body
“collider_shape_index” - index of the colliding shape, inside collider body “collider_metadata”

It seems that on the Alpha the Normal returned, which I expected to be the collision normal is not correct…

MarceloP | 2017-08-16 19:59

Yes, there is a bug on the return values on the alpha, should be solved by now, you can try to compile from master or get a more recent build.

eons | 2017-08-17 01:54