+2 votes

I'm using the moveandslide() function for my player character. The only issue with this is that it only takes global co-ordinates - if I add to the y value, the character falls down relative to the entire world when I want him to fall towards his own "down". How is this possible?

in Engine by (67 points)

Are you talking about when the KinematicBody2D is rotated?

2 Answers

0 votes

when you use the move_and_slide() function, it takes 2 arguments. The movement vector, and the up direction. If I am correct, you need to change the up direction if you want the character to fall differently. hope it helps =)

by (386 points)
0 votes

So if you want the character to fall down to it's local co-ordinates use something like this:

if Input.is_action_pressed("ui_right"):
    velocity += transform.basis.x
by (58 points)
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 webmaster@godotengine.org with your username.