0 votes

My player is using grid based with a tween doing the actual movement of everything.
A raycast2D is used to check for collisions on the destination tile.

I have a building which is a static body with child nodes for a sprite and collision (rectangle)

both the player and building are stored in a YSort Node in the scene.

This setup works most of the time, but certain areas of the map cause 1 of the buildings to let me onto a collision tile. This NOT happening at random.

This even happens across the entire length of the axis. (for example, the building allows me to cross the x-axis of the collision tile no matter what position it is on the y-axis)
These buildings can only be placed in the specific 16x16 grid which should work no matter where it's placed.
Placing the same object 1 or 2 tiles along the x-axis has it working again perfectly.

working e.g. the building is placed in a position where the far left of the collision object is at x=16.
Player cannot get onto tiles at x=16

bugged e.g. the same building is placed in a position where the far left of the collision object is at x=32.
Player can reach tiles at x=32 where it then becomes stuck within the collision object of the building

Godot version 3.3.2.stable.mono.official
in Engine by (21 points)

1 Answer

0 votes
Best answer

This seemed to have all been down to the scale of the collisionobject2d not being set to 1.
I changed the grid snap to scale the collision rectangle to the same edges as before and this no longer tricks my raycast

by (21 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.