Skip to content

Commit

Permalink
Improved particles and stuff for 4.4-beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtyIF committed Jan 17, 2025
1 parent cf74917 commit 8bc1e8b
Show file tree
Hide file tree
Showing 27 changed files with 78 additions and 600 deletions.
1 change: 1 addition & 0 deletions addons/TrailRenderer/Runtime/GD/trail_piece.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions addons/TrailRenderer/Runtime/GD/trail_renderer.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions addons/aacc/materials/particles/hit/sparks_process.tres
Original file line number Diff line number Diff line change
Expand Up @@ -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")
2 changes: 1 addition & 1 deletion addons/aacc/materials/particles/hit/sparks_render.tres
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion addons/aacc/scenes/burnout_particles.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion addons/aacc/scenes/sparks.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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")
4 changes: 2 additions & 2 deletions addons/aacc/scripts/audio/car_tire_screech_sound.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions addons/aacc/scripts/car.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion addons/aacc/scripts/car_wheel.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 3 additions & 5 deletions addons/aacc/scripts/hit_reaction.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 2 additions & 4 deletions addons/aacc/scripts/particles/sparks.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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()
21 changes: 0 additions & 21 deletions addons/smoothing/LICENSE

This file was deleted.

7 changes: 0 additions & 7 deletions addons/smoothing/plugin.cfg

This file was deleted.

235 changes: 0 additions & 235 deletions addons/smoothing/smoothing.gd

This file was deleted.

1 change: 0 additions & 1 deletion addons/smoothing/smoothing.gd.uid

This file was deleted.

Binary file removed addons/smoothing/smoothing.png
Binary file not shown.
Loading

0 comments on commit 8bc1e8b

Please sign in to comment.