x


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.

more ▼

asked Aug 26 '10 at 02:45 AM

slkjdfv gravatar image

slkjdfv
330 24 28 32

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.)

Oct 07 '11 at 07:23 PM Matt Downey

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).

Oct 07 '11 at 07:27 PM Matt Downey
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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.

more ▼

answered Aug 26 '10 at 07:02 AM

StephanK gravatar image

StephanK
6k 39 53 93

(comments are locked)
10|3000 characters needed characters left
  • 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.

more ▼

answered Aug 26 '10 at 05:15 AM

BurningThumb gravatar image

BurningThumb
154 1 5 11

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1873
x1791
x1044
x109

asked: Aug 26 '10 at 02:45 AM

Seen: 2005 times

Last Updated: Oct 07 '11 at 07:27 PM