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

Experimenting with gravity and moving platforms, head gets stuck #27537

Closed
Tracked by #45334
ignusfast opened this issue Mar 30, 2019 · 4 comments · Fixed by #50314
Closed
Tracked by #45334

Experimenting with gravity and moving platforms, head gets stuck #27537

ignusfast opened this issue Mar 30, 2019 · 4 comments · Fixed by #50314

Comments

@ignusfast
Copy link

ignusfast commented Mar 30, 2019

Godot version:
3.1 Stable Windows Mono

OS/device including version:
Windows 10

Issue description:
Using MoveAndSlide, I had to set the collision Safe Margin down to .05 to avoid sliding on moving platforms. But that introduced an issue where I couldn't jump off platforms moving against gravity. I added code that, during the first physics frame after jumping or flipping gravity, I just do a move without detection. At all other times, I do a normal MoveAndSlide. The issue is that when I reverse gravity, and I was floored to an object that is moving torward me, my now head gets stuck in the platform until it reverses direction.

I don't EVER want my head to do Floor detection, so I'm not sure why I'm getting stuck.

Steps to reproduce:
Add KinematicBody2D platforms moving up and down with a normal AnimationPlayer. Add a KinematicBody2D player. During initial frame after gravity change/jump, set Position instead of MoveAndSlide. Jumping works, but gravity change gets head stuck.

Minimal reproduction project:
Platform Game.zip
This is my first day of playing with this, so please be kind. I made the Sprite, but the background is placeholder from an online tutorial.

Bugsquad edit: MRP with gdscript: Platform.Game.zip

@girng
Copy link

girng commented Mar 30, 2019

did you try the community channels too? there are some intricacies to get collision stuff working smooth as butter with godot. if you did, ignore this post

@ignusfast
Copy link
Author

Sorry, I did not - this is literally my first day of playing with it. I did check the Godot online manuals, and did a lot of Googling, but I haven't seen anyone else really playing with gravity switching.

@ignusfast
Copy link
Author

Talking to myself here - I did change the yChange variable over to an int, and I set it to the number of frames for which I want to just update the Position, instead of running a full physics MoveAndSlide. It's a jury-rig I can live with for now, though I hope that the physics engine can be tweaked to better handle situations like this.

@jitspoe
Copy link
Contributor

jitspoe commented Jul 11, 2019

I believe this is caused by this issue here: #30481

I'm also having issues using move_and_collide() trying to collide with a moving platform. Fundamentally, the problem seems to be that the actual body positions don't update until the end of the frame, so the platform can move, push the player up, but the player won't collide with it, because it's trying to collide with the OLD platform position, which is too far below the character to touch.

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.

6 participants