sliding down steep slopes?

Blitz3D Forums/Blitz3D Beginners Area/sliding down steep slopes?

Cubed Inc.(Posted 2010) [#1]
Is there anyway to prevent your game character from going up steep slopes by making them slide down from going up to high in blitz3d? What function could determine something like this becuase I can't think of any practical way of doing it in blitz3d.


Matty(Posted 2010) [#2]
Look at the collisions command, specifically 'sliding up' collision flag (3? I think instead of 2)


Serpent(Posted 2010) [#3]
The easiest option that I can think of is using the collision option that allows sliding up AND down, and then each frame apply 'gravity' (i.e. TranslateEntity down in Y), so that your player moves more slowly up steeper slopes and will approach a limit where they can't walk up anymore because gravity matches them. There are a whole mass of downsides... but if you don't apply gravity when the player isn't moving, things shouldn't work out too terribly, but of course this isn't the best way to do it at all...

If you're using terrains, you can use "TerrainHeight" (I think it's called) to determine the height of the terrain at a specific point. Then, if you use it to determine the height at your player's position, and in front of them, you can get the slope. Then, you could use this to determine which directions the player can move in and subtract components from the movement that correspond to directions where there are steep slopes (so that you cant zig-zag your way up), and maybe then you could limit movement withing downhill sliding!

Both of my options are terrible, but I'm not sure of many better ways to do it unless you ARE using sliding collisions, or you want to allow players to 'zig-zag' up a hill... Hopefully others can suggest much better options :P


Yasha(Posted 2010) [#4]
Invisible wall?


K(Posted 2010) [#5]
I usually use the invisible wall trick but another option is to have steep slopes on a different surface or even another mesh altogether and translate the character away if it collides with that surface/mesh.
This is useful for ice sliding.

Of note if you use an invisible wall is NOT to have it at 90 straight up, but tilted slightly inward because otherwise the player could climb THAT, even with collision-check jumping. Believe me, I've done it.


D4NM4N(Posted 2010) [#6]
in addition to the sliding collisions,
If you take the normal direction from the ColisionNY, the further off vertical it is then the steeper the slope and the faster you can use translateentity to slide the player in that direction.
Unfortunately i don't have an example handy, but if you know some vector stuff then read the docs/forums for collision normals it should be quite clear.

Last edited 2010


jfk EO-11110(Posted 2011) [#7]
If you want to use CollisionNX then make sure the feet are seperate Entities (and this also complicates things since the Character or player/camera Collsion is normally used with only one Ellipsoid check against the map). A further way would be to do a Linepick towards the ground, then use PickedNX etc. If nothing is going to work as desired then you may do it the simple way: do 4 linepicks towards the ground, with a little XZ offset (just 4 points around the players feet). If there is a significant diffrence in PickedZ between any of them then the angle is high and you can set your dynamic gravity to a higher value, resulting in the player sliding down the slope. This way you can also allow the player to walk on certain rather flat angles and stop the player from slowly sliding down, as seen with plain sliding collision with gravity applied.

Then again, such a system may easily be confused by something like stairways...

Last edited 2011