0 votes

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.

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

in Engine by (15 points)

2 Answers

0 votes
Best answer

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.

by (7,908 points)
selected by

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

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).

0 votes
  • ***body2D
    -- Sprite
    --- CollisionShape2D
by (14 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.