- Home /
Problem with OnControllerColliderHit
Hi, I'm pretty new to Unity and I had a question about using OnControllerColliderHit.
I'm trying to make it so that anytime I collide with something a variable sets to true, and after when I jump I set it to false. So the end result is that I can jump off of walls.
However, when I jump while facing a wall, it automatically sets to true even though I haven't left the wall. In other words, is there a way to only check when I hit something rather than continuously check whether I'm touchin the wall?
Here's my code:
private void OnControllerColliderHit (ControllerColliderHit hit)
{
canJump = true;
}
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
OnCollisionEnter2D is not working when an object tagged "Enemy" is not present in the game. 0 Answers
Problem on collision between object 0 Answers
Why the npc character walking strange when using a Rigidbody and Is Kinematic on enabled ? 1 Answer