Full collision detection without slipping on ramps.

It’s hacky, to say the least. Tampering with forces or velocities… I’d rather just suspend Dynamics then.

Anyway, I used this technique with a 3D platform demo some time ago, and it just doesn’t work like it should in every situation. For example, you would have to tweak it so much so with slippery slopes the player would slide naturally. I just don’t like it.

maybe have an other material assigned to just the faces of the slop and a collision sensor set to that material to change the forces or whatever to compensate for the different friction.

Could you post the code, please?

Check your messages

For what? . .

I think the best way to prevent the sliding is casting a ray downwards to check if the player collides with the ground.
If it collides with the ground AND no movementkeys are pressed then set the velocity to 0.

The problem with that is that you have to make sure that the ray or collision box beneath the player should be as small as possible, so the player wouldn’t stick to the ground every time it jumps. So when jumping, the player is higher then the length of the ray in one logic tic.

If no keys are pressed and jumpclock==0 and Ray.positive:
Is what I use…

An extra variable is a solution too.

Jumpclock is nice, because it hangs at the last frame in my system until you touch the ground,

So when you jump, at the end of the jump you remain in a falling posture until touching the ground, resetting the clock.

If jump min 1 max 29 add 1 to jump

If jump ==30 and Ray is positive , jump=0

In Wrectified In the movement filter, I have a separate loop for climb ladder and jump, the rest of the animations are handled via a list filter.

also,

if not Ray.positive:
(tab)own[‘FallClock’]+=1

if own[‘FallClock’]>=5:
(tab) own[‘JumpClock’]=30

(if you fall of a ledge play fall)

Hi! I want my dynamic object to not to slide off. Is there non-python resolvement for it?

Are you using the servo motion actuator? I usually set the force limits to about 9.0/-9.0 on all axis and set linV to zero if no buttons are pressed. That will glue your player in place no matter what. Reducing the z force limit to near zero when moving will allow falling and jumping as normal.

For the logic brick setup use two actuators, one with an “and” controller and the other with a “not” controller linked to the keyboard sensor.

I actually use python for every other function apart from this one because i havent found a python script that betters it.

I use simple motion force!

Try using servo motion instead.

servo_motion.blend (439 KB)

It automatically chooses the correct force to make sure your object moves the amount you want, overcoming friction and collisions to do so.

I don’t actually recommend using unlimited force as I did in the demo. As your character is unlikely to have to climb such steep slopes, and if they did, they should struggle a bit right?
Something more like this may work better:


You can mess with the setting down the bottom but I’ve never found them to be very useful.

Sorry but, why are we resorting to using python and logic bricks to solve this issue?
Wouldn’t increasing the friction property in the material settings pretty much fix the problem?
I’ve been using this method to fix issues like this for a long time now…
The extra logic calculations is just going to slow down the game in the end.

That’s useful but it can be hard to go up the slope. Also you might want some things to slide down but not others.