0 votes

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 snap
length = 32
var snapthreshold = deg2rad(45)
var snap
vector = 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

func ymovement(delta):
if is

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***
motion.x = lerp(motion.x , 0 , 0.28)

in Engine by (38 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.