Unity-Technologies / UnityPlayground

A collection of simple scripts to create 2D physics game, intended for giving workshops to a young audience
MIT License
870 stars 164 forks source link

Possible issue with Jump.cs #8

Open ciro-unity opened 7 years ago

ciro-unity commented 7 years ago

From Art of Jimbo on Twitter

the jump scrip, even with a 'ground' tag still seems to let player jump a little higher than they should. I thought the 'ground' tag would allow player to jump once and then drop back down (depending on gravity, drag etc) but it seems even with platform elements tagged with 'ground' you can still make player jump more than they should

Westerveld commented 6 years ago

a possible fix would be to add this check to the collision statement:

collisionData.contacts[0].normal == Vector2.up

This would mean that having slanted platforms would result in the user not being able to jump off them

ciro-unity commented 6 years ago

Yeah, maybe I can check the normal in a range (so if Y is more than 0, should be a valid platform). That might introduce more bugs than fix things… we'll see. It's not a super high priority issue, but I'll leave it open as a reminder.