diff --git a/addons/TrailRenderer/Runtime/GD/trail_piece.gd b/addons/TrailRenderer/Runtime/GD/trail_piece.gd index a3e2064..9398a84 100644 --- a/addons/TrailRenderer/Runtime/GD/trail_piece.gd +++ b/addons/TrailRenderer/Runtime/GD/trail_piece.gd @@ -25,6 +25,7 @@ func _init(source_trail_renderer: TrailRenderer) -> void: func process(delta: float) -> void: + if not is_instance_valid(_line_renderer) or not is_instance_valid(_trail_renderer): return _line_renderer.copy_values(_trail_renderer) _time = Time.get_ticks_msec() / 1000.0 diff --git a/addons/TrailRenderer/Runtime/GD/trail_renderer.gd b/addons/TrailRenderer/Runtime/GD/trail_renderer.gd index 5e42502..5f4b5a4 100644 --- a/addons/TrailRenderer/Runtime/GD/trail_renderer.gd +++ b/addons/TrailRenderer/Runtime/GD/trail_renderer.gd @@ -24,9 +24,9 @@ func _process(delta: float) -> void: if _trail_pieces.size() > 0: _trail_pieces[0].on_delete_complete = _on_delete_complete - for i: int in range(_trail_pieces.size()): - var trail_piece: TrailPiece = _trail_pieces[i] - trail_piece.process(delta) + for trail_piece in _trail_pieces: + if is_instance_valid(trail_piece) and not trail_piece.is_queued_for_deletion(): + trail_piece.process(delta) func _on_delete_complete() -> void: diff --git a/addons/aacc/materials/particles/hit/sparks_process.tres b/addons/aacc/materials/particles/hit/sparks_process.tres index 8b66a4a..2635be6 100644 --- a/addons/aacc/materials/particles/hit/sparks_process.tres +++ b/addons/aacc/materials/particles/hit/sparks_process.tres @@ -9,8 +9,8 @@ curve = SubResource("Curve_avug2") [resource] particle_flag_align_y = true -direction = Vector3(0, 1, -1) -spread = 30.0 -initial_velocity_min = 5.0 -initial_velocity_max = 10.0 +direction = Vector3(0, 0, 0) +spread = 180.0 +initial_velocity_min = 2.5 +initial_velocity_max = 5.0 alpha_curve = SubResource("CurveTexture_iglnt") diff --git a/addons/aacc/materials/particles/hit/sparks_render.tres b/addons/aacc/materials/particles/hit/sparks_render.tres index f0d8908..e57069b 100644 --- a/addons/aacc/materials/particles/hit/sparks_render.tres +++ b/addons/aacc/materials/particles/hit/sparks_render.tres @@ -4,7 +4,7 @@ [sub_resource type="GradientTexture2D" id="GradientTexture2D_a2o35"] gradient = SubResource("Gradient_235fs") -fill_from = Vector2(0, 1) +fill_from = Vector2(0, 0.5) fill_to = Vector2(0, 0) [resource] diff --git a/addons/aacc/scenes/burnout_particles.tscn b/addons/aacc/scenes/burnout_particles.tscn index 5af6ae3..c026938 100644 --- a/addons/aacc/scenes/burnout_particles.tscn +++ b/addons/aacc/scenes/burnout_particles.tscn @@ -16,7 +16,7 @@ material_override = ExtResource("4_r6cyj") cast_shadow = 0 gi_mode = 0 emitting = false -amount = 50 +amount = 250 lifetime = 2.0 fixed_fps = 0 visibility_aabb = AABB(-100, -50, -100, 200, 100, 200) diff --git a/addons/aacc/scenes/sparks.tscn b/addons/aacc/scenes/sparks.tscn index 25b4a88..12a52d2 100644 --- a/addons/aacc/scenes/sparks.tscn +++ b/addons/aacc/scenes/sparks.tscn @@ -11,7 +11,7 @@ one_shot = true explosiveness = 1.0 fixed_fps = 0 trail_enabled = true -trail_lifetime = 0.1 +trail_lifetime = 0.2 process_material = ExtResource("1_5lk4l") draw_pass_1 = ExtResource("2_jdqw7") script = ExtResource("3_smau7") diff --git a/addons/aacc/scripts/audio/car_tire_screech_sound.gd b/addons/aacc/scripts/audio/car_tire_screech_sound.gd index ebe2ba8..3ee155a 100644 --- a/addons/aacc/scripts/audio/car_tire_screech_sound.gd +++ b/addons/aacc/scripts/audio/car_tire_screech_sound.gd @@ -6,9 +6,9 @@ class_name CarTireScreechSound extends AudioStreamPlayer3D var smooth_burnout_amount = SmoothedFloat.new(0.0, 4.0, 4.0) func _physics_process(delta: float) -> void: - smooth_burnout_amount.advance_to(car.burnout_amount, delta) + smooth_burnout_amount.advance_to(clamp(car.burnout_amount * 10.0, 0.0, 1.0), delta) pitch_scale = lerp(pitch_range.x, pitch_range.y, smooth_burnout_amount.get_current_value()) - volume_db = linear_to_db(car.burnout_amount) + volume_db = linear_to_db(clamp(car.burnout_amount * 10.0, 0.0, 1.0)) if is_inf(volume_db) or car.freeze: volume_db = -80.0 diff --git a/addons/aacc/scripts/car.gd b/addons/aacc/scripts/car.gd index 1b393f5..73e2fa0 100644 --- a/addons/aacc/scripts/car.gd +++ b/addons/aacc/scripts/car.gd @@ -336,12 +336,12 @@ func get_side_grip_force() -> float: func update_burnout_amount(): var burnout_colliding: float = 1.0 if ground_coefficient > 0.0 else 0.0 - var burnout_velocity: float = (abs(local_linear_velocity.x) - 0.5) / 10.0 + var burnout_velocity: float = (abs(local_linear_velocity.x) - 0.5) / 100.0 var burnout_revs: float = 0.0 if input_handbrake and linear_velocity.length() >= 0.25: - burnout_revs = linear_velocity.length() / 10.0 + burnout_revs = linear_velocity.length() / 100.0 if abs(local_linear_velocity.z) < 0.25: - burnout_revs = revs.get_current_value() + burnout_revs = revs.get_current_value() / 10.0 burnout_amount = clamp(burnout_colliding * (burnout_velocity + burnout_revs), 0.0, 1.0) #endregion diff --git a/addons/aacc/scripts/car_wheel.gd b/addons/aacc/scripts/car_wheel.gd index 15e4df1..75c98c4 100644 --- a/addons/aacc/scripts/car_wheel.gd +++ b/addons/aacc/scripts/car_wheel.gd @@ -170,7 +170,6 @@ func update_burnout() -> void: var burnout_amount: float = car.burnout_amount if car.local_linear_velocity.length() < 0.25: - burnout_amount /= 5.0 if (freeze_on_handbrake and car.input_handbrake) or block_wheelspin: burnout_amount = 0.0 diff --git a/addons/aacc/scripts/hit_reaction.gd b/addons/aacc/scripts/hit_reaction.gd index ef14b39..98358c2 100644 --- a/addons/aacc/scripts/hit_reaction.gd +++ b/addons/aacc/scripts/hit_reaction.gd @@ -40,13 +40,11 @@ func spawn_particle(i: int, state: PhysicsDirectBodyState3D, scratch_amount: flo var sparks_instance: GPUParticles3D = sparks.instantiate() sparks_instance.amount_ratio = scratch_amount add_child(sparks_instance) - sparks_instance.global_position = state.get_contact_local_position(i) + sparks_instance.global_position = state.get_contact_local_position(i) + (Vector3(randf(), randf(), randf()) * randf_range(-0.25, 0.25)) if not Vector3.UP.cross(state.get_contact_local_normal(i)).is_zero_approx(): - sparks_instance.global_basis = Basis.looking_at(state.get_contact_local_normal(i)) + sparks_instance.global_basis = Basis.looking_at(state.get_contact_local_normal(i), Vector3.UP.rotated(state.get_contact_local_normal(i), randf_range(0.0, deg_to_rad(360.0)))) else: - # Since the initial velocity direction is (0.0, 1.0, -1.0), this makes the sparks face up - sparks_instance.global_basis = Basis.from_euler(Vector3(deg_to_rad(45.0), 0.0, 0.0)) - + sparks_instance.global_basis = Basis.from_euler(Vector3(0.0, randf_range(0.0, deg_to_rad(360.0)), 0.0)) func _ready() -> void: get_node("..").body_entered.connect(play_hit_sound) diff --git a/addons/aacc/scripts/particles/sparks.gd b/addons/aacc/scripts/particles/sparks.gd index 038ba04..b5379b8 100644 --- a/addons/aacc/scripts/particles/sparks.gd +++ b/addons/aacc/scripts/particles/sparks.gd @@ -2,7 +2,5 @@ extends GPUParticles3D func _ready() -> void: emitting = true - -func _physics_process(delta: float) -> void: - if not emitting: - queue_free() + await get_tree().create_timer(1.0).timeout + queue_free() diff --git a/addons/smoothing/LICENSE b/addons/smoothing/LICENSE deleted file mode 100644 index 1742475..0000000 --- a/addons/smoothing/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 Lawnjelly - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/addons/smoothing/plugin.cfg b/addons/smoothing/plugin.cfg deleted file mode 100644 index f263dae..0000000 --- a/addons/smoothing/plugin.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[plugin] - -name="Smoothing" -description="Smoothing nodes for fixed timestep interpolation." -author="Lawnjelly" -version="1.2.1" -script="smoothing_plugin.gd" diff --git a/addons/smoothing/smoothing.gd b/addons/smoothing/smoothing.gd deleted file mode 100644 index 8f1789b..0000000 --- a/addons/smoothing/smoothing.gd +++ /dev/null @@ -1,235 +0,0 @@ -# Copyright (c) 2019 Lawnjelly -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -extends Node3D - -@export -var target: NodePath: - get: - return target - set(v): - target = v - set_target() - - -var _m_Target: Node3D - -var _m_trCurr: Transform3D -var _m_trPrev: Transform3D - -const SF_ENABLED = 1 << 0 -const SF_TRANSLATE = 1 << 1 -const SF_BASIS = 1 << 2 -const SF_SLERP = 1 << 3 -const SF_INVISIBLE = 1 << 4 - -@export_flags("enabled", "translate", "basis", "slerp") var flags: int = SF_ENABLED | SF_TRANSLATE | SF_BASIS: - set(v): - flags = v - # we may have enabled or disabled - _SetProcessing() - get: - return flags - - -########################################################################################## -# USER FUNCS - - -# call this checked e.g. starting a level, AFTER moving the target -# so we can update both the previous and current values -func teleport(): - var temp_flags = flags - _SetFlags(SF_TRANSLATE | SF_BASIS) - - _RefreshTransform() - _m_trPrev = _m_trCurr - - # do one frame update to make sure all components are updated - _process(0) - - # resume old flags - flags = temp_flags - - -func set_enabled(bEnable: bool): - _ChangeFlags(SF_ENABLED, bEnable) - _SetProcessing() - - -func is_enabled(): - return _TestFlags(SF_ENABLED) - - -########################################################################################## - - -func _ready(): - _m_trCurr = Transform3D() - _m_trPrev = Transform3D() - set_process_priority(100) - set_as_top_level(true) - Engine.set_physics_jitter_fix(0.0) - - -func set_target(): - if is_inside_tree(): - _FindTarget() - - -func _set_flags(new_value): - flags = new_value - # we may have enabled or disabled - _SetProcessing() - - -func _get_flags(): - return flags - - -func _SetProcessing(): - var bEnable = _TestFlags(SF_ENABLED) - if _TestFlags(SF_INVISIBLE): - bEnable = false - - set_process(bEnable) - set_physics_process(bEnable) - pass - - -func _enter_tree(): - # might have been moved - _FindTarget() - pass - - -func _notification(what): - match what: - # invisible turns unchecked processing - NOTIFICATION_VISIBILITY_CHANGED: - _ChangeFlags(SF_INVISIBLE, is_visible_in_tree() == false) - _SetProcessing() - - -func _RefreshTransform(): - if _HasTarget() == false: - return - - _m_trPrev = _m_trCurr - _m_trCurr = _m_Target.global_transform - -func _FindTarget(): - _m_Target = null - - # If no target has been assigned in the property, - # default to using the parent as the target. - if target.is_empty(): - var parent = get_parent() - if parent and parent is Node3D: - _m_Target = parent - return - - var targ = get_node(target) - - if ! targ: - printerr("ERROR SmoothingNode : Target " + str(target) + " not found") - return - - if not targ is Node3D: - printerr("ERROR SmoothingNode : Target " + str(target) + " is not node 3D") - target = "" - return - - # if we got to here targ is a spatial - _m_Target = targ - - # certain targets are disallowed - if _m_Target == self: - var msg = str(_m_Target.get_name()) + " assigned to " + str(self.get_name()) + "]" - printerr("ERROR SmoothingNode : Target should not be self [", msg) - - # error message - #OS.alert("Target cannot be a parent or grandparent in the scene tree.", "SmoothingNode") - _m_Target = null - target = "" - return - - -func _HasTarget() -> bool: - if _m_Target == null: - return false - - # has not been deleted? - if is_instance_valid(_m_Target): - return true - - _m_Target = null - return false - - -func _process(_delta): - - var f = Engine.get_physics_interpolation_fraction() - var tr: Transform3D = Transform3D() - - # translate - if _TestFlags(SF_TRANSLATE): - var ptDiff = _m_trCurr.origin - _m_trPrev.origin - tr.origin = _m_trPrev.origin + (ptDiff * f) - - # rotate - if _TestFlags(SF_BASIS): - if _TestFlags(SF_SLERP): - tr.basis = _m_trPrev.basis.slerp(_m_trCurr.basis, f) - else: - tr.basis = _LerpBasis(_m_trPrev.basis, _m_trCurr.basis, f) - - transform = tr - - -func _physics_process(_delta): - _RefreshTransform() - - -func _LerpBasis(from: Basis, to: Basis, f: float) -> Basis: - var res: Basis = Basis() - res.x = from.x.lerp(to.x, f) - res.y = from.y.lerp(to.y, f) - res.z = from.z.lerp(to.z, f) - return res - - -func _SetFlags(f): - flags |= f - - -func _ClearFlags(f): - flags &= ~f - - -func _TestFlags(f): - return (flags & f) == f - - -func _ChangeFlags(f, bSet): - if bSet: - _SetFlags(f) - else: - _ClearFlags(f) diff --git a/addons/smoothing/smoothing.gd.uid b/addons/smoothing/smoothing.gd.uid deleted file mode 100644 index 275ba3e..0000000 --- a/addons/smoothing/smoothing.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://bry54wpt37ira diff --git a/addons/smoothing/smoothing.png b/addons/smoothing/smoothing.png deleted file mode 100644 index 4d46817..0000000 Binary files a/addons/smoothing/smoothing.png and /dev/null differ diff --git a/addons/smoothing/smoothing.png.import b/addons/smoothing/smoothing.png.import deleted file mode 100644 index 298007d..0000000 --- a/addons/smoothing/smoothing.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://bm44ebnxqc82" -path="res://.godot/imported/smoothing.png-6b454a779e636eaa20b6c6ac618bf82a.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://addons/smoothing/smoothing.png" -dest_files=["res://.godot/imported/smoothing.png-6b454a779e636eaa20b6c6ac618bf82a.ctex"] - -[params] - -compress/mode=0 -compress/high_quality=false -compress/lossy_quality=0.7 -compress/hdr_compression=1 -compress/normal_map=0 -compress/channel_pack=0 -mipmaps/generate=false -mipmaps/limit=-1 -roughness/mode=0 -roughness/src_normal="" -process/fix_alpha_border=true -process/premult_alpha=false -process/normal_map_invert_y=false -process/hdr_as_srgb=false -process/hdr_clamp_exposure=false -process/size_limit=0 -detect_3d/compress_to=1 diff --git a/addons/smoothing/smoothing_2d.gd b/addons/smoothing/smoothing_2d.gd deleted file mode 100644 index b27ea68..0000000 --- a/addons/smoothing/smoothing_2d.gd +++ /dev/null @@ -1,209 +0,0 @@ -# Copyright (c) 2019 Lawnjelly -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -extends Node2D - - -@export -var target: NodePath: - get: - return target - set(v): - target = v - if is_inside_tree(): - _FindTarget() - -var _m_Target: Node2D -var _m_Flip:bool = false - -var _m_Trans_curr: Transform2D = Transform2D() -var _m_Trans_prev: Transform2D = Transform2D() - -const SF_ENABLED = 1 << 0 -const SF_GLOBAL_IN = 1 << 1 -const SF_GLOBAL_OUT = 1 << 2 -const SF_TOP_LEVEL = 1 << 3 -const SF_INVISIBLE = 1 << 4 - -@export_flags("enabled", "global in", "global out", "top level") var flags: int = SF_ENABLED | SF_GLOBAL_IN | SF_GLOBAL_OUT: - set(v): - flags = v - # we may have enabled or disabled - _SetProcessing() - get: - return flags - -########################################################################################## -# USER FUNCS - - -# call this checked e.g. starting a level, AFTER moving the target -# so we can update both the previous and current values -func teleport(): - _RefreshTransform() - _m_Trans_prev = _m_Trans_curr - - # call frame upate to make sure all components of the node are set - _process(0) - - -func set_enabled(bEnable: bool): - _ChangeFlags(SF_ENABLED, bEnable) - _SetProcessing() - - -func is_enabled(): - return _TestFlags(SF_ENABLED) - - -########################################################################################## - - -func _ready(): - set_process_priority(100) - Engine.set_physics_jitter_fix(0.0) - set_as_top_level(_TestFlags(SF_TOP_LEVEL)) - - -func _SetProcessing(): - var bEnable = _TestFlags(SF_ENABLED) - if _TestFlags(SF_INVISIBLE): - bEnable = false - - set_process(bEnable) - set_physics_process(bEnable) - set_as_top_level(_TestFlags(SF_TOP_LEVEL)) - - -func _enter_tree(): - # might have been moved - _FindTarget() - - -func _notification(what): - match what: - # invisible turns unchecked processing - NOTIFICATION_VISIBILITY_CHANGED: - _ChangeFlags(SF_INVISIBLE, is_visible_in_tree() == false) - _SetProcessing() - - -func _RefreshTransform(): - - if _HasTarget() == false: - return - - _m_Trans_prev = _m_Trans_curr - - if _TestFlags(SF_GLOBAL_IN): - _m_Trans_curr = _m_Target.get_global_transform() - else: - _m_Trans_curr = _m_Target.get_transform() - - _m_Flip = false - # Ideally we would use determinant core function, as in commented line below, but we - # need to workaround for backward compat. - # if (_m_Trans_prev.determinant() < 0) != (_m_Trans_curr.determinant() < 0): - - if (_Determinant_Sign(_m_Trans_prev) != _Determinant_Sign(_m_Trans_curr)): - _m_Flip = true - -func _Determinant_Sign(t:Transform2D)->bool: - # Workaround Transform2D determinant function not being available - # until 3.6 / 4.1. - # We calculate determinant manually, slower but compatible to lower - # godot versions. - var d = (t.x.x * t.y.y) - (t.x.y * t.y.x) - return d >= 0.0 - - -func _FindTarget(): - _m_Target = null - - # If no target has been assigned in the property, - # default to using the parent as the target. - if target.is_empty(): - var parent = get_parent() - if parent and (parent is Node2D): - _m_Target = parent - return - - var targ = get_node(target) - - if ! targ: - printerr("ERROR SmoothingNode2D : Target " + str(target) + " not found") - return - - if not targ is Node2D: - printerr("ERROR SmoothingNode2D : Target " + str(target) + " is not Node2D") - target = "" - return - - # if we got to here targ is correct type - _m_Target = targ - -func _HasTarget() -> bool: - if _m_Target == null: - return false - - # has not been deleted? - if is_instance_valid(_m_Target): - return true - - _m_Target = null - return false - - -func _process(_delta): - var f = Engine.get_physics_interpolation_fraction() - - var tr = _m_Trans_prev.interpolate_with(_m_Trans_curr, f) - - # When a sprite flip is detected, turn off interpolation for that tick. - if _m_Flip: - tr = _m_Trans_curr - - if _TestFlags(SF_GLOBAL_OUT) and not _TestFlags(SF_TOP_LEVEL): - set_global_transform(tr) - else: - set_transform(tr) - - -func _physics_process(_delta): - _RefreshTransform() - - -func _SetFlags(f): - flags |= f - - -func _ClearFlags(f): - flags &= ~f - - -func _TestFlags(f): - return (flags & f) == f - - -func _ChangeFlags(f, bSet): - if bSet: - _SetFlags(f) - else: - _ClearFlags(f) diff --git a/addons/smoothing/smoothing_2d.gd.uid b/addons/smoothing/smoothing_2d.gd.uid deleted file mode 100644 index 9ca91c7..0000000 --- a/addons/smoothing/smoothing_2d.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://n5pjgo568ocq diff --git a/addons/smoothing/smoothing_2d.png b/addons/smoothing/smoothing_2d.png deleted file mode 100644 index 558117a..0000000 Binary files a/addons/smoothing/smoothing_2d.png and /dev/null differ diff --git a/addons/smoothing/smoothing_2d.png.import b/addons/smoothing/smoothing_2d.png.import deleted file mode 100644 index 5f2ea11..0000000 --- a/addons/smoothing/smoothing_2d.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://i3h8ng5fyd1m" -path="res://.godot/imported/smoothing_2d.png-4942c58db397caab18506104d957cac1.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://addons/smoothing/smoothing_2d.png" -dest_files=["res://.godot/imported/smoothing_2d.png-4942c58db397caab18506104d957cac1.ctex"] - -[params] - -compress/mode=0 -compress/high_quality=false -compress/lossy_quality=0.7 -compress/hdr_compression=1 -compress/normal_map=0 -compress/channel_pack=0 -mipmaps/generate=false -mipmaps/limit=-1 -roughness/mode=0 -roughness/src_normal="" -process/fix_alpha_border=true -process/premult_alpha=false -process/normal_map_invert_y=false -process/hdr_as_srgb=false -process/hdr_clamp_exposure=false -process/size_limit=0 -detect_3d/compress_to=1 diff --git a/addons/smoothing/smoothing_plugin.gd b/addons/smoothing/smoothing_plugin.gd deleted file mode 100644 index 3bf6fb1..0000000 --- a/addons/smoothing/smoothing_plugin.gd +++ /dev/null @@ -1,17 +0,0 @@ -@tool -extends EditorPlugin - - -func _enter_tree(): - # Initialization of the plugin goes here - # Add the new type with a name, a parent type, a script and an icon - add_custom_type("Smoothing", "Node3D", preload("smoothing.gd"), preload("smoothing.png")) - add_custom_type("Smoothing2D", "Node2D", preload("smoothing_2d.gd"), preload("smoothing_2d.png")) - pass - - -func _exit_tree(): - # Clean-up of the plugin goes here - # Always remember to remove_at it from the engine when deactivated - remove_custom_type("Smoothing") - remove_custom_type("Smoothing2D") diff --git a/addons/smoothing/smoothing_plugin.gd.uid b/addons/smoothing/smoothing_plugin.gd.uid deleted file mode 100644 index ddc827e..0000000 --- a/addons/smoothing/smoothing_plugin.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://our4tw85etvc diff --git a/demo_assets/demo_scene_environment.tres b/demo_assets/demo_scene_environment.tres index 07c87fd..dfb0d03 100644 --- a/demo_assets/demo_scene_environment.tres +++ b/demo_assets/demo_scene_environment.tres @@ -14,7 +14,7 @@ sky_material = SubResource("ProceduralSkyMaterial_lg8b7") [resource] background_mode = 2 sky = SubResource("Sky_7bk1c") -tonemap_mode = 2 +tonemap_mode = 4 tonemap_white = 16.0 ssao_enabled = true glow_enabled = true @@ -22,6 +22,12 @@ glow_normalized = true glow_intensity = 1.0 glow_hdr_threshold = 2.0 glow_hdr_scale = 1.0 +fog_enabled = true +fog_light_color = Color(0.501961, 0.627451, 1, 1) +fog_density = 0.005 +fog_aerial_perspective = 1.0 +volumetric_fog_density = 0.02 +volumetric_fog_albedo = Color(0.501961, 0.627451, 1, 1) adjustment_enabled = true adjustment_contrast = 1.2 adjustment_saturation = 1.2 diff --git a/demo_assets/scripts/follow_camera_position.gd b/demo_assets/scripts/follow_camera_position.gd index bdbe7ae..32cbae7 100644 --- a/demo_assets/scripts/follow_camera_position.gd +++ b/demo_assets/scripts/follow_camera_position.gd @@ -40,11 +40,16 @@ func _physics_process(delta: float) -> void: var target_direction: Vector3 = -_car.linear_velocity.normalized() var slerp_amount: float = clamp((_car.linear_velocity.length() - 0.25) / 10.0, 0.0, 1.0) - if _car.input_handbrake and _car.input_forward > 0.0 and _car.linear_velocity.length() <= 0.25: + if Input.get_action_strength("aaccdemo_camera_recenter") or (_car.input_handbrake and _car.input_forward > 0.0 and _car.linear_velocity.length() <= 0.25): target_direction = _car.global_basis.z slerp_amount = _car.revs.get_current_value() - if Input.is_action_pressed("aaccdemo_recenter_camera"): - target_direction = _car.global_basis.z + var camera_vector: Vector2 = Input.get_vector("aaccdemo_camera_right", "aaccdemo_camera_left", "aaccdemo_camera_back", "aaccdemo_camera_forward") + if not camera_vector.is_zero_approx(): + var angle: float = camera_vector.angle_to(Vector2.DOWN) + if _car.linear_velocity.length() <= 0.25: + target_direction = _car.global_basis.z.rotated(_up_direction, angle) + else: + target_direction = target_direction.rotated(_up_direction, angle) slerp_amount = 1.0 if slerp_amount > 0.0: _direction = _plane.project(_direction.slerp(target_direction, slerp_amount * 10.0 * delta)).normalized() diff --git a/demo_assets/scripts/lookat_camera_position.gd b/demo_assets/scripts/lookat_camera_position.gd index eb6a3d7..f1d887b 100644 --- a/demo_assets/scripts/lookat_camera_position.gd +++ b/demo_assets/scripts/lookat_camera_position.gd @@ -42,6 +42,9 @@ func _physics_process(delta: float) -> void: target_forward_offset_amount *= _car.ground_coefficient if _car.input_handbrake: target_forward_offset_amount = 0.0 + var camera_vector: Vector2 = Input.get_vector("aaccdemo_camera_right", "aaccdemo_camera_left", "aaccdemo_camera_back", "aaccdemo_camera_forward") + if not camera_vector.is_zero_approx(): + target_forward_offset_amount = 0.0 _forward_offset_amount = lerp(_forward_offset_amount, target_forward_offset_amount, 1.0 * delta) final_position += Plane(up_direction).project(_car.global_basis.z) * 1.5 * _forward_offset_amount diff --git a/project.godot b/project.godot index d16dd7c..d2d4c58 100644 --- a/project.godot +++ b/project.godot @@ -30,49 +30,77 @@ window/size/viewport_height=720 [editor_plugins] -enabled=PackedStringArray("res://addons/aacc/plugin.cfg", "res://addons/smoothing/plugin.cfg") +enabled=PackedStringArray("res://addons/aacc/plugin.cfg") [input] aacc_forward={ "deadzone": 0.05, -"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":87,"physical_keycode":0,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null) +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null) , Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":5,"axis_value":1.0,"script":null) ] } aacc_backward={ "deadzone": 0.05, -"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":83,"physical_keycode":0,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null) +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null) , Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":4,"axis_value":1.0,"script":null) ] } aacc_steer_left={ "deadzone": 0.05, -"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":65,"physical_keycode":0,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null) +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null) , Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null) ] } aacc_steer_right={ "deadzone": 0.05, -"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":68,"physical_keycode":0,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null) +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null) , Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null) ] } aacc_handbrake={ "deadzone": 0.2, -"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null) +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null) , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":2,"pressure":0.0,"pressed":false,"script":null) ] } aaccdemo_reset={ "deadzone": 0.2, -"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":82,"physical_keycode":0,"key_label":0,"unicode":114,"location":0,"echo":false,"script":null) +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":82,"key_label":0,"unicode":114,"location":0,"echo":false,"script":null) , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":4,"pressure":0.0,"pressed":false,"script":null) ] } -aaccdemo_recenter_camera={ +aaccdemo_camera_forward={ +"deadzone": 0.05, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194446,"key_label":0,"unicode":56,"location":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":-1.0,"script":null) +] +} +aaccdemo_camera_back={ +"deadzone": 0.05, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194440,"key_label":0,"unicode":50,"location":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":1.0,"script":null) +] +} +aaccdemo_camera_left={ +"deadzone": 0.05, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194442,"key_label":0,"unicode":52,"location":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":-1.0,"script":null) +] +} +aaccdemo_camera_right={ +"deadzone": 0.05, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194444,"key_label":0,"unicode":54,"location":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":1.0,"script":null) +] +} +aaccdemo_camera_recenter={ "deadzone": 0.2, -"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":67,"physical_keycode":0,"key_label":0,"unicode":99,"location":0,"echo":false,"script":null) +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":67,"key_label":0,"unicode":99,"location":0,"echo":false,"script":null) , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":3,"pressure":0.0,"pressed":false,"script":null) ] } @@ -85,8 +113,8 @@ aaccdemo_recenter_camera={ [physics] -common/physics_ticks_per_second=120 -common/max_physics_steps_per_frame=16 +common/physics_ticks_per_second=240 +common/max_physics_steps_per_frame=24 common/physics_jitter_fix=0.0 3d/physics_engine="Jolt Physics" common/physics_interpolation=true