Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KinematicBody2d move_and_slide function, The value returned by a collision at a particular location is not normal #25967

Closed
myhalibobo opened this issue Feb 17, 2019 · 9 comments · Fixed by #42574

Comments

@myhalibobo
Copy link
Contributor

myhalibobo commented Feb 17, 2019

Godot version:3.1 beta4
Platform:win7
As shown in the figure below, now that my character is jumping up, and the character and platform are in this particular position, my velocity (-800,-484), at which point the character should have moved up.But move_and_slide() returns velocity(-800,0). This is incorrect.This should be a special case
ep6qqfbk 09ew88jmo_w gq

Link to minimal example project:
New Game Project.zip

@akien-mga
Copy link
Member

Can't do anything without an actual project to test on.

@myhalibobo
Copy link
Contributor Author

@akien-mga I've uploaded dome

@sicienss
Copy link

Yeah, this seems like the same issue I just posted about in #30509, thanks for referencing it @myhalibobo. Thanks also for uploading the minimal example.

@KoBeWi
Copy link
Member

KoBeWi commented Aug 23, 2020

Still valid in 58f5c2b

@capnm
Copy link
Contributor

capnm commented Oct 18, 2020

I can confirm #42574 fixes the issue (broken in 3.2.3.stable) in the 3.2 branch.

@Rhathe
Copy link
Contributor

Rhathe commented Nov 6, 2020

Have another test case showing this particular bug as well as #43012 but for one way collisions, difference is that it's broken in both 3.2.3.stable and the 3.2 branch of #42574.

snap_on_top

test_move_one_way_snap_on_top.zip

@capnm
Copy link
Contributor

capnm commented Nov 17, 2020

Have another test case showing this particular bug

Yes, you can probably construct an infinite number of extreme cases where the physics engine breaks.
Funnily enough, it works well if you just save and run your binary scene blob as tscn ;-)

@Rhathe
Copy link
Contributor

Rhathe commented Nov 18, 2020

Have another test case showing this particular bug

Yes, you can probably construct an infinite number of extreme cases where the physics engine breaks.

Not sure what makes this a particularly extreme case, not that it should necessarily be invalidated even if it was. The velocity isn't that fast(just 8 pixels horizontally and vertically per frame), the angle of approach is just 45 degrees, and aside from one y-value of 292.05, all positions and extents are whole numbers.

Funnily enough, it works well if you just save and run your binary scene blob as tscn ;-)

Did test that out, and yes the tscn version somehow works with this for some reason. Doesn't actually fix the bug though, because just changing the y-value from 292.05 to 300 gives this in 3.2.3 stable.

snap_on_top

Which means that now all values are whole numbers, so this would actually show up more readily if you make a game with objects that try to stick to a grid. This version of the test case is not broken on #42574 though.

test_move_one_way_snap_on_top_stable.zip

@madmiraal
Copy link
Contributor

@Rhathe Your examples are duplicates of #43012 i.e. they're not specific to one-way collisions.

pouleyKetchoupp added a commit to nekomatata/godot that referenced this issue Jan 21, 2021
These changes revert the part of godotengine#42576 that was skipping rest info
checking when no collision occurred in the motion check.

That allows to make floor detection consistent by checking for rest info
even if there was no collision during the motion (godotengine#45259).

On the other hand, one-way collision need another fix in order to avoid
inconsistencies between motion check and rest info check that causes
bugs like godotengine#25967. This is done by restoring valid_depth in rest info
check and set it the same way as in motion check.

Also making minor changes in _rest_cbk_result in order to early exit by
doing depth tests first, before extra calculations for normal checking.

Fixes godotengine#45259
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants