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

Horizontal player movement on ascending vertical platform causes player to move through the platform. #1

Open
ghost opened this issue Jul 27, 2015 · 3 comments

Comments

@ghost
Copy link

ghost commented Jul 27, 2015

The issue seems to lie in VerticalCollisions in the Controller2D script.

When the player inputs Horizontal movement while on an ascending platform, the VerticalCollisions function does not seem to add the expected velocity.y. I've been able to figure out that the first "if (hit) {}" of the function only evaluates to "true" some of the time while the player is on ascending platforms. Other than that I'm unsure of what exactly is causing the problem.

@kristremblay
Copy link

I haven't been through the videos in a bit so please forgive me if I'm wrong. I have found (at least for my small projects) that making the player a child of any moving platform upon collision and deparenting when breaking contact (ie a jump) solves a lot of problems in a very simple way. Hopefully this helps.

@matthewswar
Copy link

I had the same issue until I increased the Vertical Ray Count and Horizontal Ray Count on the PlatformController. 6 worked for me, though it may depend on how large your platform is.

@shmeeps
Copy link

shmeeps commented Oct 5, 2015

Same for me. Problem is that with the size of the platform, the player object can fit between the upwards rays so no collision will be detected. A possible simple fix would be to store the player's width in a constant, then override the platform class implementation of CalculateRaySpacing to use that and the platform width to generate an appropriate amount of rays for each platform automatically.

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

No branches or pull requests

3 participants