Blitz Collisions + Verlet = Climbing Walls?

Blitz3D Forums/Blitz3D Programming/Blitz Collisions + Verlet = Climbing Walls?

ClayPigeon(Posted 2010) [#1]
Okay, I know I've already posted this before, but that was like a year ago and I was naive in Blitz - sorry for that terrible explanation. I have simple verlet physics driving my player. When I walk him towards a slope, the collision response nudges him up a bit. This affects the y-velocity as well, and makes the player move up faster. This little issue allows the player to climb walls of any steepness unless they are perfectly 90° vertical or further upside-down. Maybe some of the "verlet-veterans" can help me out with this one. As the steepness of the wall increases, I want the speed at which the player can walk up it to decrease until I reach 45-60° where he will no longer be able to go up it and just slide downward.


Stevie G(Posted 2010) [#2]
Can you post a working example of what you have so far or at least explain in more detail how you are using (I assume) verlet integration to move the player?


ClayPigeon(Posted 2010) [#3]
I have 3 vars for the xyz velocities, and 3 vars for the xyz previous positions (where they were in the last frame). I'm each frame, I subtract the player's previous position from the player's current position for each axis (xyz) and store it in the corresponding velocity var. Then I do the keyboard checks and use trig to calculate how much to add to x and z velocities to get the desired direction. Then I move the player's entity by the velocity amounts using:
PositionEntity ENT_Player,EntityX(ENT_Player)+xv/1.25,EntityY(ENT_Player)+yv-0.2,EntityZ(ENT_Player)+zv/1.25

The division is for a sort of frictioney effect so the player doesn't continue moving indefinitely. Here's my player-control code:

I know -- yuck.. The base entity is just a slightly smaller copy of the player moved down to detect when the player is on the ground, so he can't just jump whenever. Also "Limit" and "Wrap" are functions to control the range of the vars so the code takes up less space.

EDIT:I just removed some stuff that's not related to the problem. I didn't spot it at first. Also, I added the "Limit" and "Wrap" functions just to make it more accurate.


ClayPigeon(Posted 2010) [#4]
Is there no way to fix this?


Noobody(Posted 2010) [#5]
Could you post a runnable version of your code? You don't have to post your whole project, but a small demo with e.g. cubes would help a lot.

It's hard to find the error just by looking at the code, especially when dealing with physics codes.


ClayPigeon(Posted 2010) [#6]
Here ya' go: Verlet Problem

AWSD to move, MOUSE to look, and hold SHIFT to run. If you run at the trapezoid-ey thing in the middle, you will find that you can sprint up the steep wall with ease. That's obviously a little odd and definitely not humanly possible. Although, while I was making this adaptation of the code, I found my problem isn't quite as bad as I thought it was -- I made some VERY steep walls that weren't quite 90°, and running at it caused me to sort of jump, then slide back down. But, the problem's still there for shallower walls.