- Home /
How to determine if the player can jump, without using raycasts. (2D)
In a 2D platformer, how would I check if the player is touching the floor without using raycasts. It has to be only if the bottom of the player is touching.
Is there any reason in particular you are opposed to raycasts? They work very well in this situation and I think any answer given would need to know why raycasts don't suit you here.
I don't want to use recasts because they aren't very reliable for this. I've already tried...
Do you $$anonymous$$d posting what you tried? Ground check raycasts are a common solution to this problem. $$anonymous$$aybe we can help debug your raycast issues, rather than try to come up with a novel solution to a routine situation.
Actually I think I have it working now, the problem was the length of the recast...
After reading through your code, that was my suspicion as well. It looks like you're raycasting from the middle of your character controller straight down. If the raycast length doesn't work, you can also try adding a child GameObject at the character's feet and raycast from that point. That lets you do a shorter, more controlled raycast that sticks near the bottom of the character.
Answer by hairymangoz · Sep 05, 2015 at 07:02 AM
I think this is what you are looking for: https://www.youtube.com/watch?v=2akPDnmSfu8
Your answer
Follow this Question
Related Questions
Using RayCasting to check for floor and ceiling? 0 Answers
Player stucken in the wall while jumping 2D 1 Answer
GetButtonDown not always firing 1 Answer
Multiple keys not detected at once 1 Answer
Jump 2D error 1 Answer