I’m willing to accept that this question has been asked a hundred times before, but all of the answers I’ve tried over the last hour or so haven’t worked.
Basically I have a Raycast which goes beneath my character in order to check if he’s touching the ground to enable him to jump again. I’ve since then added some trigger colliders to stuff to dampen velocity, but the raycast hits this trigger collider (which obviously I walk through not stand on) so it makes the jumping unusual. As such, I need to be able to get the raycast to ignore this. I’m trying to do this with tag. I have tagged the offending trigger collider “JumpStop”, and I have added an if statement to the raycast to check that the tag of the object raycasted != “JumpStop”.
It doesn’t work, and I’m pretty sure it’s because I’m not doing the raycast properly. Please help.
I have a variable declared at the start (GameObject hitInfo)
if (Physics.Raycast (transform.position, Vector3.down, out hitInfo, raycastLength))
{
if (hitInfo.collider.tag != "JumpStop") {
jumping = false;
}
}
Is there something obviously wrong here?