Skip to content

Instantly share code, notes, and snippets.

@nurcinozer
Created January 9, 2019 16:54
Show Gist options
  • Save nurcinozer/0f5ffaefd7f4ac20f5d1788321d5ec03 to your computer and use it in GitHub Desktop.
Save nurcinozer/0f5ffaefd7f4ac20f5d1788321d5ec03 to your computer and use it in GitHub Desktop.
private bool isgrounded = true; //let's assume he's on the ground
void oncollisionstay (collision other)
{
if (other.name != "ground") //let's assume the name of the ground object is ground
{
isgrounded = false;
if (isgrounded = false && other.name != "ground")
{
//disable the jumping and wait for when the player is on the ground again
if (other.name == "ground")
{
isgrounded = true; //add the jumping mechanic back in
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment