Skip to content

Instantly share code, notes, and snippets.

@geekrelief
Created March 8, 2021 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geekrelief/f0b4ff02d15445252eb6f63c196e64ac to your computer and use it in GitHub Desktop.
Save geekrelief/f0b4ff02d15445252eb6f63c196e64ac to your computer and use it in GitHub Desktop.
extends Node
export var move_speed := 3.0
var db
func _ready():
db = get_node("/root/DataBind")
func _physics_process(delta):
var movement:Vector3
if Input.is_action_pressed("move_forward"):
movement -= db.val("camera_forward")
if Input.is_action_pressed("move_backward"):
movement += db.val("camera_forward")
if Input.is_action_pressed("move_left"):
movement -= db.val("camera_right")
if Input.is_action_pressed("move_right"):
movement += db.val("camera_right")
db.put("movement", movement.normalized() * move_speed)
extends KinematicBody
var db
export var movement:Vector3
func _enter_tree() -> void:
db = get_node("/root/DataBind")
db.src("movement", get_path(), "movement")
func _physics_process(delta):
move_and_slide(movement)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment