How to counter gravity from all sides but keep movement intact with 0 friction

Hello,

Ok as the title says: How to counter gravity from all sides but keep movement/jumping intact with 0.0 friction.

What?
Past week i made a simple blend to be able to walk on spheres/animated objects etc, etc.

I just rewrote the script, due to i didn’t like it, atm with the default friction (0.500) it works perfectly fine. But i need 0.0 friction else the player will not drop down if you jump and hit a wall and keep pressing the movement keys.

Don’t tell me to do velocity *.1 or something because velocity is already 0.0 at that point, it’s purely the gravity i’m fighting with. Does anyone know an ‘easy’ solution?

Atm. i use this to counter the gravity (with the default 0.500 player friction)
It’s the code to push the player against the object at all times

        counter_force = 40
        vector = -own.worldOrientation.col[2] * counter_force
        counter_gravity = own.applyForce(vector,False) 
own.localLinearVelocity.x*=.95
own.localLinearVelocity.y*=.5

is what I use to mimic friction
(my actors typically float above the surface)

to cancel gravity use

object.applyForce((0,0,9.8*own.mass),0)

That’s why i said this: ‘Don’t tell me to do velocity *.1 or something because velocity is already 0.0 at that point, it’s purely the gravity i’m fighting with’.

I do not want friction at all, i wanna get rid of it. and keep my char in place, but still able to walk/jump on any side of the object(s)

Ok, I’m to tired, but fixed it.

I tried applyForce() before, i also use that to counter, but didn’t work because it kept pushing the player up into the air and without additional checks rays etc. it did not work., but i actually did not try it again with the new gravity code that i made (in first post), so i tried it again, seems to work well in combination with the above script, no additional lines of code needed.

Sorry for this stupid question, tiredness does that with you.

ray cast direction of movement (from input or actual (worldPos-oldWorldPos) vector) and if raycast hit kill movement.

that should prevent wall clinging and could be used to stop run/walk animations.

Hey,

Yup that’s one way to do it, but not my way, collision itself stops the player.
I finished the code and i’m happy with the results now, i will update the topic in resources.

Funny part is, the script now has more comments then code haha.

for anyone interested Walk and stick on animated objects and planets