mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-07-12 18:43:49 +00:00
33 lines
913 B
GDScript
33 lines
913 B
GDScript
extends RigidBody3D
|
|
|
|
var speed = 10.0 # Adjust the speed as necessary
|
|
|
|
func _integrate_forces(state):
|
|
# TODO - change these so they are relative to the vehicle, not the world
|
|
var input_vector = Vector3.ZERO
|
|
if Input.is_action_pressed("move_forward"):
|
|
input_vector.z -= 1
|
|
if Input.is_action_pressed("move_backward"):
|
|
input_vector.z += 1
|
|
if Input.is_action_pressed("move_left"):
|
|
input_vector.x -= 1
|
|
if Input.is_action_pressed("move_right"):
|
|
input_vector.x += 1
|
|
if Input.is_action_pressed("move_up"):
|
|
input_vector.y += 1
|
|
if Input.is_action_pressed("move_down"):
|
|
input_vector.y -= 1
|
|
|
|
input_vector = input_vector.normalized() * speed
|
|
state.linear_velocity = input_vector
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
pass # Replace with function body.
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta):
|
|
pass
|