various fixes
This commit is contained in:
@@ -30,4 +30,4 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if target:
|
||||
global_position = global_position.lerp(target.global_position, follow_speed * delta)
|
||||
global_position = global_position.lerp(target.global_position, 1.0 - exp(-follow_speed * delta))
|
||||
|
||||
@@ -24,7 +24,6 @@ extends RigidBody3D
|
||||
var _probe_offsets: Array[Vector3] = [] # local space
|
||||
|
||||
var _ocean: Ocean
|
||||
# var _probes: Array[Marker3D] = [] TODO: Probably unused
|
||||
var _gravity: float = ProjectSettings.get_setting("physics/3d/default_gravity")
|
||||
var submerged_ratio := 0.0
|
||||
|
||||
@@ -39,10 +38,12 @@ func _ready() -> void:
|
||||
if _probe_offsets.is_empty():
|
||||
for col in probe_grid.x:
|
||||
for row in probe_grid.y:
|
||||
var tx := 0.5 if probe_grid.x <= 1 else col / float(probe_grid.x - 1)
|
||||
var tz := 0.5 if probe_grid.y <= 1 else row / float(probe_grid.y - 1)
|
||||
_probe_offsets.append(Vector3(
|
||||
lerpf(-probe_extents.x, probe_extents.x, col / float(probe_grid.x - 1)),
|
||||
lerpf(-probe_extents.x, probe_extents.x, tx),
|
||||
probe_extents.y,
|
||||
lerpf(-probe_extents.z, probe_extents.z, row / float(probe_grid.y - 1))))
|
||||
lerpf(-probe_extents.z, probe_extents.z, tz)))
|
||||
|
||||
|
||||
|
||||
|
||||
+9
-4
@@ -30,16 +30,21 @@ extends MeshInstance3D
|
||||
set(value):
|
||||
iter_geometry = value
|
||||
_push("ITER_GEOMETRY", value)
|
||||
## Node the ocean mesh stays centered under (camera rig or boat).
|
||||
## Half-size of the rendered ocean square, in meters.
|
||||
|
||||
## Half-size of the rendered ocean square, in meters
|
||||
@export var render_distance := 100.0:
|
||||
set(value):
|
||||
render_distance = value
|
||||
if is_node_ready():
|
||||
_rebuild_mesh()
|
||||
## World-space distance between mesh vertices; smaller = more wave detail.
|
||||
|
||||
@export var vertex_spacing := 1.0
|
||||
## World-space distance between mesh vertices; smaller = more wave detail.
|
||||
@export var vertex_spacing := 1.0:
|
||||
set(value):
|
||||
vertex_spacing = value
|
||||
if is_node_ready():
|
||||
_rebuild_mesh()
|
||||
|
||||
var _phase := 0.0
|
||||
var _wave_offset := Vector2.ZERO
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ extends Node
|
||||
|
||||
@export var current_controlled : Boat:
|
||||
set(value):
|
||||
if current_controlled != null and current_controlled != value:
|
||||
current_controlled.desired_throttle = 0.0
|
||||
current_controlled.steer_input = 0.0
|
||||
current_controlled = value
|
||||
if is_node_ready():
|
||||
if current_controlled != null:
|
||||
@@ -57,6 +60,9 @@ func _process(delta: float) -> void:
|
||||
current_controlled.fire_weapons()
|
||||
|
||||
func _possess() -> void:
|
||||
camera_rig.target = current_controlled
|
||||
world_manager.focus = current_controlled
|
||||
hud.boat = current_controlled
|
||||
if camera_rig != null:
|
||||
camera_rig.target = current_controlled
|
||||
if world_manager != null:
|
||||
world_manager.focus = current_controlled
|
||||
if hud != null:
|
||||
hud.boat = current_controlled
|
||||
|
||||
@@ -18,7 +18,7 @@ func launch(def: AmmoDef, muzzle: Transform3D, speed_scale := 1.0) -> void:
|
||||
reset_physics_interpolation()
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if Vector3.UP.cross(linear_velocity).length_squared() > 0.01:
|
||||
if linear_velocity.length_squared() > 0.01 and absf(linear_velocity.normalized().dot(Vector3.UP)) < 0.999:
|
||||
look_at(global_position + linear_velocity)
|
||||
|
||||
_time_left -= delta
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
extends Label
|
||||
|
||||
@export var boat: Boat
|
||||
@export var world: WorldManager
|
||||
|
||||
var boat: Boat # Assigned by hud
|
||||
var world: WorldManager # Assigned by hud
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if boat == null or world == null:
|
||||
|
||||
@@ -12,6 +12,10 @@ func can_mount(def: WeaponDef) -> bool:
|
||||
|
||||
func mount(def: WeaponDef) -> bool:
|
||||
if not can_mount(def):
|
||||
push_warning("%s can't mount %s" % [
|
||||
name,
|
||||
def.display_name if def != null else "<null def>"
|
||||
])
|
||||
return false
|
||||
unmount()
|
||||
weapon = def.weapon_scene.instantiate()
|
||||
|
||||
Reference in New Issue
Block a user