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

Inconsistent floor collision #24050

Closed
Tracked by #45334
Sslaxx opened this issue Nov 29, 2018 · 12 comments
Closed
Tracked by #45334

Inconsistent floor collision #24050

Sslaxx opened this issue Nov 29, 2018 · 12 comments

Comments

@Sslaxx
Copy link

Sslaxx commented Nov 29, 2018

This is probably related to #19956 and #20290.

Godot version:
3.0.6.

OS/device including version:
Windows, Linux (tested on both, as more than one developer involved).

Issue description:

We're working on a 2D Sonic platformer, Sonic Outbreak. The project does not use is_on_floor or the like due to its use of physics (angling collision bodies to slopes/ramps for one, its seeming requirement for movement in order to work etc).

Floor collision is unreliable and seems to show different levels of "collision" (if any) with random jumps.

at_start - this is how the project looks at the start of running it. Collision with the floor appears to be as expected.

Jumping with place usually produces this: jump_1

It usually alternates between what is expected/correct (the first picture) and this.

Sometimes, this happens instead: jump_2 - similar, but smaller "gap".

I note #19956 talked about potentially problematic tilesets. Recreating the tileset did not fix this issue.

Steps to reproduce:
Play the game, try jumping (jumping in place, jumping while moving etc).

Minimal reproduction project:

24050_demonstrator.zip
Zip contains Windows (64-bit) and Linux (64-bit) binaries.

Sslaxx referenced this issue in Sslaxx/Sonic_Outbreak Nov 29, 2018
In any case, recreating the tileset with correct (integer) numbers does NOT
fix the "floating player" issues.

godotengine/godot#19956 and godotengine/godot#20290
should be investigated further.

Signed-off-by: Stuart "Sslaxx" Moore <[email protected]>
@CptPotato
Copy link
Contributor

CptPotato commented Nov 29, 2018

I suspect this is due to the way you check collisions with the ground (and how it affects the player's velocity) though it's hard to tell without any code.

Edit: I just saw there's a github repo and at first glance it seems my assumption is right. You'll have to correct the player's position or velocity when landing since physics works in discrete timesteps and the player will not always be at the same y-position when you detect hitting the ground.

@Piet-G
Copy link
Contributor

Piet-G commented Nov 29, 2018

Might be related to #23675 if you're using stop_on_slope

EDIT: Oh yeah this is 3.0.6 so it isn't that issue.

@piratesephiroth
Copy link
Contributor

piratesephiroth commented Nov 29, 2018

Might be related to #23675 if you're using stop_on_slope

he's on 3.0.6 so it still uses the functional slope_stop_min_velocity

Anyway I think it's your collision checking code that's broken.

@Sslaxx
Copy link
Author

Sslaxx commented Dec 4, 2018

This is quite possible. The existing code doesn't use any of the features like is_on_floor, instead relying on the collision rays for detection. However, it doesn't quite explain the inconsistency?

The entire movement and collision code is going to be re-written anyway because of said issues (and other reasons).

@piratesephiroth
Copy link
Contributor

I guess you're just making the fall stop as soon as the rays detect the flloor. So sometimes you stop earlier, sometimes later.
You should perhaps make the character slide along the collision's normal instead. It would then be ejected out of the floor.

@akien-mga
Copy link
Member

Can anyone still reproduce this bug in Godot 3.2.1 or any later release (e.g. 3.2.2-rc2)?

If yes, please ensure that an up-to-date Minimal Reproduction Project (MRP) is included in this report (a MRP is a zipped Godot project with the minimal elements necessary to reliably trigger the bug). You can upload ZIP files in an issue comment with a drag and drop.

@Sslaxx
Copy link
Author

Sslaxx commented Jul 21, 2020

The code in Sonic_Outbreak - when last looked at - replicated the issues I described back in 2018. It does not use is_on_floor. Godot_Sonic_Engine does. As "Sonic Outbreak" was the original project I referred to when submitting this issue, this was the one that failed.

I cannot, to the best of my abilities, replicate this issue using the Sonic Outbreak code with 3.2.2. I cannot remember if I could with the other code (though it may not be relevant seeing as it uses is_on_floor). Can anyone else?

Zip file includes both "Sonic Outbreak" and "Godot Sonic Engine" for comparison purposes.

https://www.dropbox.com/s/6hyj1h4tlga8akn/24050_Demonstrator_possible.7z?dl=0

@Sslaxx
Copy link
Author

Sslaxx commented Jul 31, 2020

Note that this isn't as entirely "fixed" as it may seem, though. With Sonic Outbreak, player_generic.gd, line 178 is move_and_slide ((-400) * ground_normal, floor_normal) - and without this, the inconsistent floor collision issue happens. It should be obvious that this line isn't really fixing the issue - not least because it breaks is_on_floor and related functionality (even more).

@pouleyKetchoupp
Copy link
Contributor

Could you please check if the issue is still present in 3.4 beta 6?

@Sslaxx
Copy link
Author

Sslaxx commented Oct 6, 2021

I'm uncertain if this is related to this issue, but attempting to run the Sonic Outbreak project with 3.4 beta 6 gives this:

================================================================
handle_crash: Program crashed with signal 4
Engine version: Godot Engine v3.4.beta6.official (3e2bb415a9b186596b9ce02debc79590380c2355)
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x41040) [0x7f3528ea3040] (??:0)
[2] /home/stuart/tmp/Godot_v3.4-beta6_x11.64() [0x28f7275] (??:0)
[3] /home/stuart/tmp/Godot_v3.4-beta6_x11.64() [0x28fb376] (??:0)
[4] /home/stuart/tmp/Godot_v3.4-beta6_x11.64() [0x2735418] (??:0)
[5] /home/stuart/tmp/Godot_v3.4-beta6_x11.64() [0x273d9fe] (??:0)
[6] /home/stuart/tmp/Godot_v3.4-beta6_x11.64() [0x2229ae9] (??:0)
[7] /home/stuart/tmp/Godot_v3.4-beta6_x11.64() [0x305b88c] (??:0)
[8] /home/stuart/tmp/Godot_v3.4-beta6_x11.64() [0x2221df9] (??:0)
[9] /home/stuart/tmp/Godot_v3.4-beta6_x11.64() [0x222bc60] (??:0)
[10] /home/stuart/tmp/Godot_v3.4-beta6_x11.64() [0x2b76d69] (??:0)
[11] /home/stuart/tmp/Godot_v3.4-beta6_x11.64() [0x2be02f5] (??:0)
[12] /home/stuart/tmp/Godot_v3.4-beta6_x11.64() [0xaa5ebc] (??:0)
[13] /home/stuart/tmp/Godot_v3.4-beta6_x11.64() [0xa35400] (??:0)
[14] /home/stuart/tmp/Godot_v3.4-beta6_x11.64() [0x1d60437] (??:0)
[15] /home/stuart/tmp/Godot_v3.4-beta6_x11.64() [0x222a2c8] (??:0)
[16] /home/stuart/tmp/Godot_v3.4-beta6_x11.64() [0x1d7e956] (??:0)
[17] /home/stuart/tmp/Godot_v3.4-beta6_x11.64() [0x1d95280] (??:0)
[18] /home/stuart/tmp/Godot_v3.4-beta6_x11.64() [0x9d30d1] (??:0)
[19] /home/stuart/tmp/Godot_v3.4-beta6_x11.64() [0x942d6d] (??:0)
[20] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xd5) [0x7f3528e8a565] (??:0)
[21] /home/stuart/tmp/Godot_v3.4-beta6_x11.64() [0x9568ee] (??:0)
-- END OF BACKTRACE --
================================================================

Along with:

stuart@sslaxxworks-amd:~/tmp$ ERROR: Resource file not found: res://Audio/Sound/no_sound.ogg.
   at: _load (core/io/resource_loader.cpp:275)
SCRIPT ERROR: Parse Error: Can't preload resource at path: res://Audio/Sound/no_sound.ogg
          at: GDScript::reload (res://Scripts/Audio/sound_player.gd:44)
ERROR: Method failed. Returning: ERR_PARSE_ERROR
   at: reload (modules/gdscript/gdscript.cpp:566)
SCRIPT ERROR: Parse Error: The identifier "global_space" isn't declared in the current scope.
          at: GDScript::reload (res://Scripts/ui/dead_player.gd:50)
ERROR: Method failed. Returning: ERR_PARSE_ERROR
   at: reload (modules/gdscript/gdscript.cpp:566)

Unable to replicate using commit 5c97f2c of https://github.com/Sslaxx/Godot_Sonic_Engine (the last commit before I started using another codebase).

@Sslaxx
Copy link
Author

Sslaxx commented Oct 6, 2021

Using a self-compiled custom build 3.4 3e2bb41 I get no such crashing.

@pouleyKetchoupp
Copy link
Contributor

@Sslaxx Thanks for testing! I'm closing since the floor collision issue is fixed in 3.4.

I was able to reproduce the crash in latest 3.x, it happens randomly and it's due to using move_and_slide along with Multi-threaded mode for the 2D physics server. I'm going to open a separate issue.

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

No branches or pull requests

6 participants