+1 vote


I'm trying to have my Player stop moving when their CollisionShape hits a predefined boundary in a map.

Here's a very basic idea of what this map boundary could look like
. Basically, I want to keep the Player within the white area. The issue I'm having with this is that the geometry of the CollisionShape for this area would be complicated and hollow in different places.

Is there some way that I can achieve this just through the color properties of the image, or by making the white area transparent and preventing the Player CollisionBox with hitting the black part of the image? If not, what would be the best way to implement this?


Godot version 3.4
in Engine by (13 points)

1 Answer

0 votes

You can try attaching a CollisionPolygon2D to StaticBody2D nodes, as it allows drawing complex shapes for collisions manually.

by (32 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 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 webmaster@godotengine.org with your username.