jchmack
14-01-2008 18:42:33
I need to determine if a character is touching the ground so he can't just jump over and over again. I have a couple ideas on how to achieve this:
Raycast below the character: seems like this would work the best but i would prefer to not have to do a raycast every frame. I know raycasts are cheap but they still aren't free.
Change to an "in the air" state when a character jumps and change back when he touches the ground: I'm thinking that this would allow one free air jump if the character just walked off an edge. The only way to prevent this would be to raycast again which would defeat the purpose of this method.
Somebody has to have experience with something like this. All advice is greatly appreciated.
Raycast below the character: seems like this would work the best but i would prefer to not have to do a raycast every frame. I know raycasts are cheap but they still aren't free.
Change to an "in the air" state when a character jumps and change back when he touches the ground: I'm thinking that this would allow one free air jump if the character just walked off an edge. The only way to prevent this would be to raycast again which would defeat the purpose of this method.
Somebody has to have experience with something like this. All advice is greatly appreciated.