Fixed rocket halo distance fade

feature-rocketlauncher
unfa 2022-01-01 03:04:34 +01:00
parent 02d0bee09c
commit 751b369163
1 changed files with 2 additions and 2 deletions

View File

@ -25,7 +25,7 @@ var ray_previously : bool = false
func _ready():
var halo_material = halo.mesh.surface_get_material(0).duplicate()
halo.mesh.surface_set_material(0, halo_material)
halo.set_surface_override_material(0, halo_material)
#$OmniLight3D/Smoke.emitting = true
func _physics_process(delta):
@ -66,7 +66,7 @@ func _process(delta):
if halo.visible:
var fade = 1 - clamp(pow(physics_ray_query_parameters_3d.from.distance_to(physics_ray_query_parameters_3d.to), 1.5) / 800, 0, 1)
#print(fade)
halo.mesh.surface_get_material(0)["albedo_color"] = halo_color * fade
halo.get_surface_override_material(0)["albedo_color"] = halo_color * fade
func give_damage(target: Node, hit_position: Vector3, hit_normal: Vector3, damage: int, source_position: Vector3, type: Globals.DamageType, push: float):
if target.has_method(&'take_damage'): # we've hit a player or something else - the ywill handle everything like effects etc.