Collision Extends Outside CollisionShape2D

binarycatbinarycat Posts: 1Member

Hey! I'm in the process of moving a project over from GML to Godot, and I've been devouring tutorials and pouring over demos, but I've been struggling with this bug.

I based my starting player scene and code heavily on the Kinematic Character demo (but I built it all by hand; no copy/pasting). Barring a few (presently unused) variables for other things (e.g. health), my movement code is pretty much a line-for-line duplicate of the code found in the demo. All the properties of the player scene (KinematicBody2D > Sprite, CollisionShape2D) match the demo exactly, except that my stand-in sprite is rectangular instead of square (and the CollisionShape2D has been changed accordingly). From my reading, I understand that scaling nodes like KinematicBody can cause weird bugs, but none of the player's nodes have been scaled (they're all 1, 1).

In addition, the player will not move along slopes - at all. As my slopes are at 45 degree angles, I changed the movement code to allow for that (I believe the default in the demo was 40 degrees; I bumped mine to 50, but that had no effect) The player does, however, count as touching the ground, and jumping functions as it should. Frankly, I'm baffled. I've tried remaking the player scene from scratch a few times, with no luck. Effectively, it looks like the player's collision area extends ~16 pixels to the right and below the sprite, and I can't figure out why.

Here are some images of what I mean. The red zones in the latter two pictures are the collision tiles.


Going right:

Going left:

Interestingly, I tried creating a version of the player as a RigidBody2D (with no code) just to see what would happen, and the bug persists. The player falls as expected, but "lands" 16 pixels above the ground.

Any insight into this would be greatly appreciated. Thanks!


  • mlzionmlzion Posts: 1Member

    I just had the same problem with a rigidbody and area nodes. The rigidbody would trigger area before being close to area even though the area in the editor window showed it far from rigidbody. I had to scale down the area to get it to look right. Not sure if this is a bug or what???

Sign In or Register to comment.