Collision problem
I have my player object, which is just a small cube at the moment. It has 2 box colliders, one that fits around it to collide with things normally, and one trigger box collider that sits inside the cube on all sides except the bottom, where it extends out by 0.1 (it has a y offset of -0.1), so it in theory should only be triggered if the bottom of the cube is touching something, so basically if it is on the ground or it has landed on something.
In my code for jumping I have a boolean "isJumping" which becomes true when you jump, (checks to make sure it's not already true, so you can't keep jumping in the air) and then is reset to false onTriggerEnter2D
It works fine most of the time. If he';s on the floor, he can jump, and he can't jump again in mid-air. If he jumps up and hits his head on a block or something above him, he still can't jump again even with that collision, since the collider is beneath him and so hasn't been triggered.
However, if he jumps up onto a block and stands on it, then jumps up and hits his head on a second block above him, for some reason then that block above him is triggering the collision, and you can keep pressing jump and keep jumping up into the block without ever coming down again.
I have linked to a screencast of all this happening, so you can see it in action, and see the colliders and the scripts behind it.
http://cmrwarwicker.com/files/jumpproblem.mp4
Can anyone shed any light on this for me? I've not been able to work this out for ages.
$$anonymous$$uch easier to use a raycast for checking for ground really. This way is more reliable .