Compare commits
2
Commits
cff83b6356
...
e8e5391d9f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8e5391d9f | ||
|
|
86abae27dd |
@@ -221,7 +221,7 @@ func detect_wall_horizontal() -> Vector3:
|
||||
var hit := space_state.intersect_ray(ray)
|
||||
if not hit.is_empty():
|
||||
var collider = hit.get("collider")
|
||||
if collider is PlayerMovementController:
|
||||
if collider is PlayerMovementController or collider is CharacterBody3D or collider.has_method("take_damage"):
|
||||
continue
|
||||
var n: Vector3 = hit.get("normal", Vector3.ZERO)
|
||||
# Wall must be roughly vertical (normal mostly horizontal)
|
||||
@@ -242,7 +242,7 @@ func detect_wall_horizontal() -> Vector3:
|
||||
var hit := space_state.intersect_ray(ray)
|
||||
if not hit.is_empty():
|
||||
var collider = hit.get("collider")
|
||||
if collider is PlayerMovementController:
|
||||
if collider is PlayerMovementController or collider is CharacterBody3D or collider.has_method("take_damage"):
|
||||
continue
|
||||
var n: Vector3 = hit.get("normal", Vector3.ZERO)
|
||||
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
|
||||
var best_hit = hit_mid if not hit_mid.is_empty() else hit_low
|
||||
|
||||
if best_hit.get("collider") is PlayerMovementController:
|
||||
var collider = best_hit.get("collider")
|
||||
if collider is PlayerMovementController or collider is CharacterBody3D or collider.has_method("take_damage"):
|
||||
return {"hit": false, "normal": Vector3.ZERO, "is_short": false}
|
||||
|
||||
var normal: Vector3 = best_hit.get("normal", Vector3.ZERO)
|
||||
|
||||
@@ -94,10 +94,10 @@ func _process(_delta: float) -> void:
|
||||
# Airborne Drift
|
||||
# Convert player velocity into camera's local space
|
||||
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
|
||||
_target_drift_offset.x = clampf(_target_drift_offset.x, -0.1, 0.1)
|
||||
_target_drift_offset.y = clampf(_target_drift_offset.y, -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.05, 0.05)
|
||||
else:
|
||||
_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)
|
||||
|
||||
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.RIGHT, deg_to_rad(_current_drift_offset.y * 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 * 30.0))
|
||||
|
||||
# Visual Recoil
|
||||
_recoil_pitch = lerpf(_recoil_pitch, 0.0, 15.0 * _delta)
|
||||
|
||||
Reference in New Issue
Block a user