save changes
This commit is contained in:
parent
a04478b516
commit
aec842980e
@ -34,7 +34,7 @@ volumetric_fog_density = 0.0
|
||||
[node name="CustomSkies" type="WorldEnvironment"]
|
||||
environment = SubResource("Environment_8p04f")
|
||||
script = ExtResource("2_unvmv")
|
||||
rateOfTime = 500.0
|
||||
rateOfTime = 100.0
|
||||
skyRotation = 18.5
|
||||
|
||||
[node name="SunMoonLine" type="Node3D" parent="."]
|
||||
@ -52,5 +52,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -5)
|
||||
|
||||
[node name="MoonDirectionalLight3D" type="DirectionalLight3D" parent="SunMoonLine/MoonNodes"]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
|
||||
light_energy = 0.01
|
||||
light_energy = 0.05
|
||||
light_angular_distance = 1.0
|
||||
shadow_enabled = true
|
||||
|
@ -11,12 +11,13 @@ var piloting_player: Player = null
|
||||
|
||||
var ship_id: int = 0
|
||||
var ship_is_piloted: bool = false
|
||||
var turn_speed: float = 10.0
|
||||
var lift_speed: float = 10.0
|
||||
var top_speed: float = 10.0
|
||||
var move_speed: float = 10.0
|
||||
var acceleration: float = 10.0
|
||||
var deceleration: float = 20.0
|
||||
@export_range(0.01, 1.0, 0.01) var base_turn_speed: float = 0.3
|
||||
@export var max_turn_speed: float = 0.5
|
||||
@export_range(0.01, 1.0, 0.01) var base_lift_speed: float = 2.0
|
||||
@export var top_speed: float = 5.0
|
||||
@export var move_speed: float = 10.0
|
||||
@export var acceleration: float = 10.0
|
||||
@export var deceleration: float = 20.0
|
||||
|
||||
|
||||
func _ready():
|
||||
@ -33,7 +34,33 @@ func _ready():
|
||||
|
||||
func _physics_process(delta):
|
||||
if ship_is_piloted:
|
||||
pass
|
||||
var turn_speed = base_turn_speed / max(mass, 1)
|
||||
var lift_speed = base_lift_speed / max(mass, 1)
|
||||
if Input.is_action_pressed("move_left"):
|
||||
angular_velocity.y += turn_speed
|
||||
elif Input.is_action_pressed("move_right"):
|
||||
angular_velocity.y -= turn_speed
|
||||
else:
|
||||
global_rotation.z = lerpf(global_rotation.z, 0, 0.8)
|
||||
|
||||
if Input.is_action_pressed("jump"):
|
||||
linear_velocity.y += lift_speed
|
||||
elif Input.is_action_pressed("crouch"):
|
||||
linear_velocity.y -= lift_speed
|
||||
|
||||
if Input.is_action_pressed("move_forwards"):
|
||||
var forward_force = (((-transform.basis.z * move_speed) - linear_velocity) * mass).normalized()
|
||||
apply_central_force(forward_force)
|
||||
elif Input.is_action_pressed("move_backwards"):
|
||||
var forward_force = (((transform.basis.z * move_speed) - linear_velocity) * mass).normalized()
|
||||
apply_central_force(forward_force)
|
||||
|
||||
|
||||
angular_velocity.y = clamp(angular_velocity.y, -max_turn_speed, max_turn_speed)
|
||||
|
||||
# Self level slowly
|
||||
global_rotation.x = lerpf(global_rotation.x, 0, 0.1)
|
||||
global_rotation.z = lerpf(global_rotation.z, 0, 0.1)
|
||||
|
||||
|
||||
func _on_area_3d_body_entered(body):
|
||||
|
Loading…
Reference in New Issue
Block a user