0 votes

ar gravity = 9.8
var location = Vector3()
var capncrunch = Vector3()
export var speed = 7
export var jump_height = 9
var velocity = Vector3()

func getinput():
velocity = Vector3()
if Input.is
actionpressed('uiright'):
velocity.x += 1
if Input.isactionpressed('uileft'):
velocity.x -= 1
if Input.is
actionpressed("uiforward"):
velocity.z -= 1
if Input.isactionpressed("ui_backwards"):
velocity.z += 1
velocity = velocity.normalized() * speed

func physicsprocess(delta):
getinput()
velocity = move
andslide(velocity)
move
andslide(globaltransform.basis.xform(capncrunch), Vector3.UP)

if Input.is_action_just_pressed("jump"):
    if is_on_floor():
        capncrunch.y = jump_height

if not is_on_floor():
    capncrunch.y -= gravity * delta
in Engine by (58 points)

was my answer in your previous question any good? It uses local coordinates.

no it didnt unfortunately

your code would be a lot easier to read if you select it all and press the {} icon. =)

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 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.