aled96
1
Hi, i have a character that can fly, but i want that if he touch, with his feet, the ground the fly-mode become “false”.
But this not happens.
This is the part of the code, regarding flyght:
if (anim.GetBool (“IsFlying”) == true) {
if(Physics.Raycast(ray, out hit))
{
if(hit.collider.CompareTag("Terrain")){
anim.SetBool("IsFlying",false);
p1.SetActive(false);
}
}
}
But if he touches the ground, he doesn’t stop flying…
Can someone help me ? thank you
Zentiu
2
try putting your player on a layer called Ignore Raycast.
see if that helps.
did you already create your ray?
is the terrain tagged as terrain?