- Home /
Rigid body floating the air when I jump at a wall... how do I fix?
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.
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. $$anonymous$$y 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
Answer by StephanK · Aug 26, 2010 at 07:02 AM
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.
Answer by BurningThumb · Aug 26, 2010 at 05:15 AM
- Use a rigid body based character controller and make your walls a little bouncy.
or
- Create a collision area around you stairs, that disables you anti-wall jumping logic OnCollisionStay()
- Create a small waiting period between when the forward direction is applied to your character controller, so you player progressively falls down, do not allow jump unless character controller is on the ground.
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.
Your answer
Follow this Question
Related Questions
Make rigidbody walk like character controller 6 Answers
How do I make a rigidbody move on command (ie A Player Character)? 1 Answer
Preventing rigidbodys from jumping on a tiled map 0 Answers
Character Controller Jittering 0 Answers
How to prevent friction for character along vertical surfaces? 2 Answers