Hello !
I followed a tutorial recently where I’ve made a simple platform with a platform effector 2d attached to it. I’ve made it so I can go back through the platform if I keep the down arrow key pressed enough time by rotating the said-platformEffector2D. Everything works fine until I have to “reset” the platform to its initial state. I’ve made it so my platformeffector2d resets when the character pressed up again with this script :
if (Input.GetKey(KeyCode.UpArrow)) {
effector.rotationalOffset = 0;
}
Sadly, when I put that in my script, everything works fine unless I keep the uparrow pressed when jumping from below the platform. When I do and if the bottom half of my character touches the platform, my character is automatically “pushed” upward on the platform.
It’s quite problematic since sometimes, the character can “almost” jump on a platform but shouldn’t really be able to. If I don’t modify this, the player would only have to keep the up arrow key pressed and could be “teleported” some pixels above its position and be on top of the said platform…
Does anybody has any idea why it does that and how I should avoid this ?