|
Ok I'm using the function OnCollisionStay to check when I'm inconytact with the ground and its working just fine until I jump at a wall. When I do that my character just stays there floating and not falling until I release my move forward key. So I tried using a raycast and that seemed to work but now I cant go up and down stairs. Help please.
(comments are locked)
|
|
You are not saying what you are doing in OnCollisionStay(), but I guess you are just checking for any collision and treat this as grounded. If you tag your ground you can just check if the collision is with the ground or something else (wall, enemy etc.) and only set grounded = true if the you're colliding with the ground.
(comments are locked)
|
or
The exact details will vary based on the specifics of your game, if you try to be more specific about your raycast logic, and what you are trying to achieve it would help narrow down the correct solution.
(comments are locked)
|

I'm having the same issue. Out of curiosity, have you found a way to fix this? I know why it's happening (moving slowly and parallel to the wall doesn't cause "wallriding" but moving straight towards it or at a small angle of incidence and high speed does). I tried to make walls vector reject the player's movement, which didn't work but I only tried it for about a week. If you have any lead that I can follow I'd greatly appreciate it. My best guess was to add my own gravity system, which I was planning on doing anyway. (In my editor, wall riding happens despite gravity being enabled and y-velocity not being set to zero every frame.)
Another key part, I check for the y-component of the normal vector. I group objects into walls, ceiling and floor based on whether y is in the -0.05 < x && x < 0.05 range, x >= 0.05 range, or x <= -0.05 range respectively (using collision data).