Kinematic Body (3D) and Static Body (3D) are not colliding

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GunPoint

As you can see in the photo, I have a kinematic body as a player and a wall as a static body.
They both have collision shapes. The problem is that the player is able to walk through the wall.
Note: The wall scene is smaller, the instanced scene is resized. If I change the wall to be a rigid body, the collision works but it resizes in the wrong way (the engine also tells that there may be problems with resizing rigid bodies - Godot 3.1 stable). So what’s the problem? I can’t use static bodies to make walls?

“resizing” is a bit of an arbitrary term. Do you scale or edit the extents?

You should keep the scale of the statticbody and the collision shape at 1. Instead edit the extents of the collision shape. If you use several instances of your wall scene then make the subnodes editable and make the collision box shape of each collision shape unique. (if you don’t, all shapes will change if you edit one.)

wombatstampede | 2019-04-21 14:20

I changed a few things. In the wall scene I left the entire thing un-scaled and in the main scene i scaled it (under transform - translation). It still doesn’t work. I added in the scene another static body which had a box collision shape. And the player was just going through it. Strange, because it works if i change that static body to a rigid body. So the problem is that my player can’t detect static bodies… :frowning:
EDIT: The wall still works if i make it a rigid body but if i change it to a rigid static body (from the inspector - mode:rigid) it doesn’t work.

GunPoint | 2019-04-21 18:32

:bust_in_silhouette: Reply From: GunPoint

Solved. It was a problem with the player script. Apparently, if a kinematic body is using translate() to move in the world, for some reason it will not detect static bodies (i mean their collision shapes)

Yes, you must move a kinematic body with move_and_collide() or move_and_slide() if you want it to detect collisions.

kidscancode | 2019-04-21 21:43