Why if I CollisionShape.set_trigger(true) it doesn't collide?

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

According to the documentation:

  • void set_trigger ( bool enable )

Set whether this shape is a trigger. A trigger shape detects
, but is otherwise unaffected by physics (i.e. will not
block movement of colliding objects).

but it doesn’t detects collisions at all. A bug?

I want to stop the body when it hits first time the floor but it doesn’t collide at all because it is set as trigger.
Any help is welcome.

extends KinematicBody2D

const GRAVITY = 200.0 
var velocity = Vector2()
var gravity
var first_time=true

func _ready():

func _fixed_process(delta):
	var force = Vector2(0, gravity)
	velocity += force*delta
	var motion = velocity*delta

	motion = move(motion)
		var n=get_collision_normal()
		if first_time:

Then don’t set it as trigger.

Anutrix | 2017-04-10 12:08

:bust_in_silhouette: Reply From: kubecz3k

Take a look at this piece of documentation: http://docs.godotengine.org/en/latest/tutorials/2d/physics_introduction.html#in-case-of-overlap-who-receives-collision-information
In case of KinematicBody vs StaticBody collision, no one receives the information about the collision.
If you are using body as a trigger, then I would suggest to use Area node instead, if you connect signal body_enter from Area node you will still receive the information about collision with StaticBody. You can put this Area as a child of your KinematicBody, or convert Kinematic to Area (it’s your call, both will work)

Every time I read that documentation you point in your link I get more confused.

Reading that table, how it is possible that two KinematicBody2D doesn’t report collision information to each other? What’s the use of KinematicBody2D.is_colliding() method then?
If I can detect collision information from both KinematicBody2D using the is_colliding() method, why I can’t detect it again when the shape is set to trigger?

Either the documentation is wrong or there is a bug.

genete | 2016-04-22 09:50

@genete, I’m unable to answer those question, When I started with Godot (v1.0) this table was accurate and everything was working like it said. Since now you are telling me that 2 KinematicBodies can get info about colliding each other it seems that docs are outdated. When it comes to trigger… I’m unsure as well, since from the time Area nodes have those handy signals I was not using trigger shapes…
From practical point of view I’m suggesting to try Area, when it comes to the questions itself - maybe someone else will have better answers (or suggestions). Sorry for that!

kubecz3k | 2016-04-22 10:47