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. one way collision makes the character fall through when standing on an upward moving platform #9399

Closed
rubenjavier opened this issue Jun 26, 2017 · 22 comments

Comments

@rubenjavier
Copy link

Operating system or device - Godot version:
Linux Ubuntu 64bit commit 36548a3

Issue description:
in OneWay collisions you can't set how far you can go inside the CollisionShape2D, and for moving platforms going upward, you always go throught the platform and fall, when the moving platform is moving downward or horizontally, you dont fall

Steps to reproduce:
set a KinematickBody2D with a CollisionShape2D and set the OneWay Collision checkbox on the shape make the shape move upward with set_transform and see your character fall through

@reduz
Copy link
Member

reduz commented Jun 26, 2017 via email

@rubenjavier
Copy link
Author

dont worry, take your time and do your thing... if someone is really good at thinking here, its you man

@akien-mga akien-mga added this to the 3.0 milestone Jul 12, 2017
@akien-mga akien-mga changed the title [3.0] the new OneWay Collision makes the character fall through when is standing on an upward moving platform KinematicBody2D. one way collision makes the character fall through when standing on an upward moving platform Jul 12, 2017
@akien-mga
Copy link
Member

Confirmed by @damarindra in #9614, with a test project to reproduce the issue:

Download example project, and run TestScene
Platformer.zip

@eon-s
Copy link
Contributor

eon-s commented Jul 12, 2017

The issue affects rigid bodies too.

@reduz
Copy link
Member

reduz commented Aug 19, 2017

fixing this is difficult, will kick to 3.1

@reduz reduz modified the milestones: 3.1, 3.0 Aug 19, 2017
@reduz
Copy link
Member

reduz commented Aug 19, 2017

thinking about it, one alternative could be to, once collision happen, to apply it normally (not one-way) in the next frames (must remember that it was one way in the previous frame, this is where things get difficult specially for Kinematicbody), but it should be possible..

@rubenjavier
Copy link
Author

sad news to have it kicked into next release, this leaves many of my platforms broken... but I trust you reduz

@kubecz3k
Copy link
Contributor

kubecz3k commented Apr 3, 2018

First of all thank you for your report and sorry for the delay.

We released Godot 3.0 in January 2018 after 18 months of work, fixing many old issues either directly, or by obsoleting/replacing the features they were referring to.

We still have hundreds of issues whose relevance/reproducibility needs to be checked against the current stable version, and that's where you can help us.
Could you check if the issue that you described initially is still relevant/reproducible in Godot 3.0 or any newer version, and comment about its current status here?

For bug reports, please also make sure that the issue contains detailed steps to reproduce the bug and, if possible, a zipped project that can be used to reproduce it right away. This greatly speeds up debugging and bugfixing tasks for our contributors.

Our Bugsquad will review this issue more in-depth in 15 days, and potentially close it if its relevance could not be confirmed.

Thanks in advance.

Note: This message is being copy-pasted to many "stale" issues (90+ days without activity). It might happen that it is not meaningful for this specific issue or appears oblivious of the issue's context, if so please comment to notify the Bugsquad about it.

@eon-s
Copy link
Contributor

eon-s commented Apr 4, 2018

This still affects 3.0.2 and current master.

@jahd2602
Copy link
Contributor

Is there any work-around for this issue? Like using a function like using a function similar to get_floor_velocity() to correct the velocity. (Tried that function, doesn't work)

@eon-s
Copy link
Contributor

eon-s commented Jun 14, 2018

@jahd2602 not easy, you can put 2 shapes on the platform, if the player touched the one side it on the solid part, enable the full contact shape, keep monitoring the player until it leaves, disabling the full contact shape.

@jahd2602
Copy link
Contributor

Thanks, @eon-s, I could get a good behavior by disabling one-way and adding this to the moving platform:

func _physics_process(delta):
	$CollisionShape2D.disabled = global_position.y <= global.player.global_position.y

@reduz reduz self-assigned this Sep 5, 2018
@reduz reduz closed this as completed in 414097e Nov 2, 2018
@doquen
Copy link

doquen commented Nov 15, 2018

Hi, It happens to me that when standing on one way collision ground, if a KinematicBody2D or RigidBody2D stands on another KinematicBody2d or RigidBody2d, ti sometimes makes the one below fall trhough the ground. Is this issue related to this? It still affects 3.1 alpha.

@Zireael07
Copy link
Contributor

The fix was made after 3.1 alpha, and I guess yes your issue is related.

@doquen
Copy link

doquen commented Nov 15, 2018

Thanks! And is there any workarround for this in stable release?

Thanks, @eon-s, I could get a good behavior by disabling one-way and adding this to the moving platform:

func _physics_process(delta):
    $CollisionShape2D.disabled = global_position.y <= global.player.global_position.y 

This does not work for me cause i have multiple bodies... should i open new question for this?

@eon-s
Copy link
Contributor

eon-s commented Nov 15, 2018

@pablof7 this is marked as cherry pick so it will probably land on the next 3.0

A workaround for many bodies may be using special layers or exceptions, controlled on each body (or apply the fix and build a custom engine).

@doquen
Copy link

doquen commented Nov 20, 2018

Hi,
I've cloned and compiled the master branch, and I've checked the fix is there in the correct file. However i still get the problem that one Body can make another one fall through one way platforms when standing on it. Could it not be the same issue that the one with moving platforms?
Thanks

@eon-s
Copy link
Contributor

eon-s commented Nov 20, 2018

@pablof7 I think that is another problem, open a new issue and provide an example to so it can be tested easily.

@doquen
Copy link

doquen commented Nov 20, 2018

Ok, Thanks!

@hedrickbt
Copy link

hedrickbt commented Dec 2, 2018

I am seeing the same issue in 3.0.6 and 3.1 alpha. Attaching example. If you jump a few times (ui_up) you will fall through the platform.

sol-3-kinematicbody2d.zip

@eon-s
Copy link
Contributor

eon-s commented Dec 2, 2018

@hedrickbt it was fixed after alpha, check on a more recent build.

If you cannot build from master, try with the daily builds from this site https://bintray.com/calinou/godot

@hedrickbt
Copy link

@hedrickbt it was fixed after alpha, check on a more recent build.

If you cannot build from master, try with the daily builds from this site https://bintray.com/calinou/godot

@eon-s , confirmed! It is working great. Thanks for the help. I missed that I needed to run based on the nightly build of 3.1+: https://hugo.pro/projects/godot-builds/

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.

9 participants