CollisionShape2D doesn't align with how it's shaped?

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

Sorry for the stupid question but I can’t seem to get the CollisionShape2D to work properly. I have it attached to a StaticBody2D which itself is under a Sprite node. I then export the scene to a TileSet and add it to a TileMap on the world scene along with the player. The collision however doesn’t work as I expected. I think I’m missing something vital here. Here’s a video to demonstrate the process I go through to add the collision and the subsequent wrongly sized/placed collision happening on the actual running game.

:bust_in_silhouette: Reply From: eons

You are scaling the CollisionShape node instead of setting the size/extents of the rectangle shape (you can see that on the inspector).

Use the handles of the shape to modify it correctly or edit the shape entry on the inspector.

Also, you can toggle snap to make more precise tilesets.

Okay I managed to make the collision area larger.

enter image description here

But it’s still misaligned when being run in-game. (See here)

https://www.youtube.com/watch?v=L5h3axqeD_k

And I do have snapping disabled but it still does it.

enter image description here

surashu | 2017-04-14 21:15

If you are translating the CollisionShape that may give problems (I can’t remember the status of that now), try with a CollisionPolygon instead, since the points can be moved while the CollisionPolygon helper stays on (0,0).

eons | 2017-04-14 21:39

:bust_in_silhouette: Reply From: xLampa
  • ***body2D
    – Sprite
    — CollisionShape2D