# Sliding down slopes

In the game engine, when i have my player walking around the scene it seems to slowly slide down slopes and ramps etc. How can I prevent this sliding from happening just like in most other games?

• Turn up friction on character's physics? – BlendingJake Jan 31 '15 at 3:14
• That didn't seem to do anything. – christai Jan 31 '15 at 3:27
• I've experienced this also without being able to fix it +1 – Scalia Jan 31 '15 at 15:59

connect all the sensors you are using for motion to a python controller.

add a ray sensor, -z that will reach from the origin to below the actors lower collision bound. connect this as well,

sensors --------python
Ray-------------/


break

import bge

cont = bge.logic.getCurrentController()

own = cont.owner
Ray = cont.sensors['Ray']

your_sensor_1 = cont.sensors['YourSensor']

## etc

if not your_sensor.positive and Ray.positive:
own.worldLinearVelocity*=.9
own.applyForce((0,0,(own.mass*9.8)),0)
##if you are on the ground and not pressing any movement keys like forward or backward
## stop moving

• You forget to set the ray sensor to true pulse triggering, but thanks anyway. It worked after that. – christai Mar 8 '15 at 20:54