Hello
I'm moving my KB2D with moveandslidewithsnap
I was wandering if someone can help me to completely stop my KB2D if encountering slopes from a certain angle(over 45 degrees to be exact
note: my slopes are staticbody2D
var snapdir = Vector2.DOWN
var snaplength = 32
var snapthreshold = deg2rad(45)
var snapvector = snapdir*snaplength
var up = Vector2.UP
var motion = Vector2.ZERO
func physicsprocess(delta):
motion.y=moveandslidewithsnap(motion,snapvector , up , true ,4 ,snapthreshold).y
motion.y += gravity
y_movement()
func ymovement(delta):
if ison_floor():
motion.y = 0
if Input.isactionpressed("ui_up"):
motion.y = max_jump_height
motion =move_and_slide(motion,up) # ***that's how I disable snap***
else:
motion.x = lerp(motion.x , 0 , 0.28)