Open jraicr opened 8 years ago
I'll try to take a look this weekend.
Moving minimum distance from environment up to .1 solves the sticking, but introduces some glide.
I had a similar issue but changing it to 0.55 improved things greatly and has (I hope) fixed the issue I had of the main character dropping through one way platforms too.
First of all thank you for this amazing library!
Any news on this issue?
I've been looking the code and I think that there is some bug in PlatformerMotor2D.CheckSurroundings() but I'm not sure... Is this possible?
To avoid this issue I did a workaround that adds/removes the moving platform layer to the variable "Moving Platforms Layer" when the player approaches to the moving platform. I used an additional collider object to trigger that. It isn't the most elegant way but it works fine.
No news on the issue, been slammed with other projects and haven't been able to look at this one.
Definitely possible there's a bug in PlatformerMotor2D.CheckSurroundings() :)
I think I may have fixed the problem. The line that is causing all of this is in UpdateMovingPlatform() on line 1741. Replace _collisionMask with movingPlatformLayerMask. I think the motor was detecting the static environment and caused the problem with SeparateFromEnvironment() being triggered wrongly.
I hope this helps as i have been banging my head against the issue for over a year on and off. I was even convinced that I would have to specifically design around having either slopes or moving platforms.
While I haven't tested this thoroughly, it seems to have fixed the issue I was having: Once I implemented moving platforms, my player was getting randomly stuck in slopes he jumped into, whether above or below. The only workaround I had was to set Minimum Distance from Environment as low as it would let me and that was about 97% effective. After changing the line of code you suggested, I put Minimum Distance from Environment back to its default setting (0.1) and tried to get stuck in a slope and after about 10 minutes of bouncing around I haven't gotten stuck once. It probably needs more testing before closing the issue but preliminary tests look good in my case.
Last but not least, thanks for the awesome character controller.
Glad to hear this seems to be on the right track. 👍 I imagine this needs to be tested a bunch more before I'm satisfied that it's a solution but otherwise I haven't gotten stuck yet after a week of playtesting with it
When the motor have available the moving platform option, assigning a layer mask to it, the player get stucked when trying to get up/down slopes. Everything works fine with the slopes when no layer mask is assigned.