Feat/12 add effects and better animations to fpv #17
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user