Compare commits

..
2 Commits
2 changed files with 9 additions and 9 deletions
+4 -4
View File
@@ -221,7 +221,7 @@ func detect_wall_horizontal() -> Vector3:
var hit := space_state.intersect_ray(ray) var hit := space_state.intersect_ray(ray)
if not hit.is_empty(): if not hit.is_empty():
var collider = hit.get("collider") var collider = hit.get("collider")
if collider is PlayerMovementController: if collider is PlayerMovementController or collider is CharacterBody3D or collider.has_method("take_damage"):
continue continue
var n: Vector3 = hit.get("normal", Vector3.ZERO) var n: Vector3 = hit.get("normal", Vector3.ZERO)
# Wall must be roughly vertical (normal mostly horizontal) # Wall must be roughly vertical (normal mostly horizontal)
@@ -242,7 +242,7 @@ func detect_wall_horizontal() -> Vector3:
var hit := space_state.intersect_ray(ray) var hit := space_state.intersect_ray(ray)
if not hit.is_empty(): if not hit.is_empty():
var collider = hit.get("collider") var collider = hit.get("collider")
if collider is PlayerMovementController: if collider is PlayerMovementController or collider is CharacterBody3D or collider.has_method("take_damage"):
continue continue
var n: Vector3 = hit.get("normal", Vector3.ZERO) var n: Vector3 = hit.get("normal", Vector3.ZERO)
if absf(n.y) < 0.3 and n.length_squared() > 0.0: if absf(n.y) < 0.3 and n.length_squared() > 0.0:
@@ -294,8 +294,8 @@ func detect_wall_forward() -> Dictionary:
# Get the normal from the highest point we hit, or the lowest if we only hit low # Get the normal from the highest point we hit, or the lowest if we only hit low
var best_hit = hit_mid if not hit_mid.is_empty() else hit_low var best_hit = hit_mid if not hit_mid.is_empty() else hit_low
var collider = best_hit.get("collider")
if best_hit.get("collider") is PlayerMovementController: if collider is PlayerMovementController or collider is CharacterBody3D or collider.has_method("take_damage"):
return {"hit": false, "normal": Vector3.ZERO, "is_short": false} return {"hit": false, "normal": Vector3.ZERO, "is_short": false}
var normal: Vector3 = best_hit.get("normal", Vector3.ZERO) var normal: Vector3 = best_hit.get("normal", Vector3.ZERO)
+5 -5
View File
@@ -94,10 +94,10 @@ func _process(_delta: float) -> void:
# Airborne Drift # Airborne Drift
# Convert player velocity into camera's local space # Convert player velocity into camera's local space
var local_vel = camera.global_transform.basis.inverse() * player.velocity var local_vel = camera.global_transform.basis.inverse() * player.velocity
_target_drift_offset = Vector3(local_vel.x * 0.01, local_vel.y * 0.01, 0) _target_drift_offset = Vector3(local_vel.x * 0.004, local_vel.y * 0.004, 0)
# Clamp the drift # Clamp the drift
_target_drift_offset.x = clampf(_target_drift_offset.x, -0.1, 0.1) _target_drift_offset.x = clampf(_target_drift_offset.x, -0.05, 0.05)
_target_drift_offset.y = clampf(_target_drift_offset.y, -0.1, 0.1) _target_drift_offset.y = clampf(_target_drift_offset.y, -0.05, 0.05)
else: else:
_target_drift_offset = Vector3.ZERO _target_drift_offset = Vector3.ZERO
@@ -105,8 +105,8 @@ func _process(_delta: float) -> void:
_current_drift_offset = _current_drift_offset.lerp(_target_drift_offset, 15.0 * _delta) _current_drift_offset = _current_drift_offset.lerp(_target_drift_offset, 15.0 * _delta)
vm_camera.translate_object_local(_current_drift_offset) vm_camera.translate_object_local(_current_drift_offset)
vm_camera.rotate_object_local(Vector3.UP, deg_to_rad(-_current_drift_offset.x * 50.0)) vm_camera.rotate_object_local(Vector3.UP, deg_to_rad(-_current_drift_offset.x * 30.0))
vm_camera.rotate_object_local(Vector3.RIGHT, deg_to_rad(_current_drift_offset.y * 50.0)) vm_camera.rotate_object_local(Vector3.RIGHT, deg_to_rad(_current_drift_offset.y * 30.0))
# Visual Recoil # Visual Recoil
_recoil_pitch = lerpf(_recoil_pitch, 0.0, 15.0 * _delta) _recoil_pitch = lerpf(_recoil_pitch, 0.0, 15.0 * _delta)