mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-07-12 18:43:49 +00:00
chore(*): Remove redundant files
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
extends Camera3D
|
||||
|
||||
@export var vehicle: RigidBody3D
|
||||
@export var ball: RigidBody3D
|
||||
|
||||
func _physics_process(delta):
|
||||
if vehicle and ball:
|
||||
# Adjust the offset based on your scene scale
|
||||
# Increasing Y component to raise the camera higher above the vehicle
|
||||
var offset = Vector3(0, 2, -2) # Adjust Y to change height
|
||||
|
||||
# Position the camera behind and above the vehicle
|
||||
var behind_vehicle = vehicle.global_transform.origin - vehicle.global_transform.basis.z * offset.z
|
||||
behind_vehicle += vehicle.global_transform.basis.y * offset.y
|
||||
|
||||
global_transform.origin = behind_vehicle
|
||||
|
||||
look_at(ball.global_transform.origin, Vector3.UP)
|
||||
@@ -1,37 +0,0 @@
|
||||
extends 'res://scripts/Vehicle.gd'
|
||||
|
||||
func get_input_vector() -> Vector3:
|
||||
var input_vector = Vector3.ZERO
|
||||
var camera_path = "/root/MatchNode3D/Players/GridContainer/SubViewportContainer/SubViewport/Player1/Camera3D"
|
||||
var camera = get_node(camera_path)
|
||||
|
||||
if camera:
|
||||
var camera_transform = camera.global_transform
|
||||
var forward_direction = -camera_transform.basis.z
|
||||
var right_direction = camera_transform.basis.x
|
||||
var y_movement = input_vector.y
|
||||
|
||||
if Input.is_action_pressed("move_forward"):
|
||||
input_vector += forward_direction
|
||||
if Input.is_action_pressed("move_backward"):
|
||||
input_vector -= forward_direction
|
||||
if Input.is_action_pressed("move_left"):
|
||||
input_vector -= right_direction
|
||||
if Input.is_action_pressed("move_right"):
|
||||
input_vector += right_direction
|
||||
|
||||
# Zero out the Y component to restrict movement to the XZ plane
|
||||
input_vector.y = 0
|
||||
|
||||
# Add back the preserved Y movement
|
||||
input_vector.y = y_movement
|
||||
|
||||
if Input.is_action_pressed("move_up"):
|
||||
input_vector.y += 1
|
||||
if Input.is_action_pressed("move_down"):
|
||||
input_vector.y -= 1
|
||||
|
||||
return input_vector.normalized()
|
||||
else:
|
||||
print("Camera not found")
|
||||
return Vector3.ZERO
|
||||
@@ -1,37 +0,0 @@
|
||||
extends 'res://scripts/Vehicle.gd'
|
||||
|
||||
func get_input_vector() -> Vector3:
|
||||
var input_vector = Vector3.ZERO
|
||||
var camera_path = "/root/MatchNode3D/Players/GridContainer/SubViewportContainer/SubViewport/Player1/Camera3D"
|
||||
var camera = get_node(camera_path)
|
||||
|
||||
if camera:
|
||||
var camera_transform = camera.global_transform
|
||||
var forward_direction = -camera_transform.basis.z
|
||||
var right_direction = camera_transform.basis.x
|
||||
var y_movement = input_vector.y
|
||||
|
||||
if Input.is_action_pressed("move_forward2"):
|
||||
input_vector += forward_direction
|
||||
if Input.is_action_pressed("move_backward2"):
|
||||
input_vector -= forward_direction
|
||||
if Input.is_action_pressed("move_left2"):
|
||||
input_vector -= right_direction
|
||||
if Input.is_action_pressed("move_right2"):
|
||||
input_vector += right_direction
|
||||
|
||||
# Zero out the Y component to restrict movement to the XZ plane
|
||||
input_vector.y = 0
|
||||
|
||||
# Add back the preserved Y movement
|
||||
input_vector.y = y_movement
|
||||
|
||||
if Input.is_action_pressed("move_up2"):
|
||||
input_vector.y += 1
|
||||
if Input.is_action_pressed("move_down2"):
|
||||
input_vector.y -= 1
|
||||
|
||||
return input_vector.normalized()
|
||||
else:
|
||||
print("Camera not found")
|
||||
return Vector3.ZERO
|
||||
Reference in New Issue
Block a user