godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.16k stars 20.21k forks source link

KinematicBody2D: test_move breaks when parent is offset from (0, 0) #26003

Open 11clock opened 5 years ago

11clock commented 5 years ago

Godot version: 3.1 beta 4

OS/device including version: Windows 10

Issue description: When a kinematic body 2d's parent does not have the position (0, 0), test_move behaves incorrectly.

Steps to reproduce: Open attached project. Play the LevelBase scene by itself. Notice that it works normally. Now change LevelBase's position and test again. Notice that the platformer character will no longer behave correctly, such as refusing to jump, fast falling off ledges, etc. These have to do with the test_move checks in Player.gd, which is basic platforming logic. you can also test in TestRoom.tscn, and see how it impacts the game in Main.tscn.

Minimal reproduction project: Spectrum.zip

mrcdk commented 5 years ago

This is a documentation issue, test_move() needs the global transform of the object.

vesk4000 commented 4 years ago

Wow thanks for the clarification that test_move() requires the global transform! But this is seriously terrible documentation, I mean it's kind of alright for the most part, but there are so many things that are underdocumented in Godot, and this one just ruined a whole game jam for me. I'll definitely try to fix this in the documentation, although I have never edited it, so I hope it is not too hard.