adj: projectile physics when moving backwards
This commit is contained in:
+1
-1
@@ -63,7 +63,7 @@ func _spawn_custom_projectile(origin: Vector3, fire_dir: Vector3) -> void:
|
||||
proj.logical_source = origin
|
||||
proj.velocity = fire_dir * projectile_speed
|
||||
if player:
|
||||
proj.velocity += fire_dir * player.velocity.dot(fire_dir)
|
||||
proj.velocity += fire_dir * max(0.0, player.velocity.dot(fire_dir))
|
||||
proj.damage = base_damage
|
||||
proj.min_damage = min_damage
|
||||
proj.falloff_start = falloff_start
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@ func _spawn_custom_projectile(origin: Vector3, fire_dir: Vector3) -> void:
|
||||
|
||||
proj.velocity = fire_dir * projectile_speed
|
||||
if player:
|
||||
proj.velocity += fire_dir * player.velocity.dot(fire_dir)
|
||||
proj.velocity += fire_dir * max(0.0, player.velocity.dot(fire_dir))
|
||||
proj.damage = base_damage
|
||||
proj.min_damage = min_damage
|
||||
proj.falloff_start = falloff_start
|
||||
|
||||
@@ -88,8 +88,6 @@ func _spawn_custom_projectile(origin: Vector3, fire_dir: Vector3) -> void:
|
||||
|
||||
var light = OmniLight3D.new()
|
||||
light.light_color = Color(0.2, 0.6, 1.0)
|
||||
light.light_energy = 2.0
|
||||
light.omni_range = 4.0
|
||||
proj.add_child(light)
|
||||
|
||||
proj.position = muzzle_flash.global_position if muzzle_flash else origin
|
||||
@@ -97,13 +95,15 @@ func _spawn_custom_projectile(origin: Vector3, fire_dir: Vector3) -> void:
|
||||
|
||||
proj.velocity = fire_dir * projectile_speed
|
||||
if player:
|
||||
proj.velocity += fire_dir * player.velocity.dot(fire_dir)
|
||||
proj.velocity += fire_dir * max(0.0, player.velocity.dot(fire_dir))
|
||||
proj.damage = base_damage
|
||||
proj.min_damage = min_damage
|
||||
proj.falloff_start = falloff_start
|
||||
proj.max_range = max_range
|
||||
proj.drop_gravity = projectile_gravity
|
||||
proj.owner_player = player
|
||||
light.light_energy = 2.0
|
||||
light.omni_range = 4.0
|
||||
proj.impact_type = "plasma"
|
||||
|
||||
# Spawn in the world
|
||||
|
||||
@@ -91,7 +91,7 @@ func _spawn_custom_projectile(origin: Vector3, fire_dir: Vector3) -> void:
|
||||
proj.logical_source = origin
|
||||
proj.velocity = fire_dir * projectile_speed
|
||||
if player:
|
||||
proj.velocity += fire_dir * player.velocity.dot(fire_dir)
|
||||
proj.velocity += fire_dir * max(0.0, player.velocity.dot(fire_dir))
|
||||
proj.damage = base_damage
|
||||
proj.min_damage = min_damage
|
||||
proj.falloff_start = falloff_start
|
||||
|
||||
@@ -165,14 +165,13 @@ func _spawn_custom_projectile(origin: Vector3, fire_dir: Vector3) -> void:
|
||||
# Logic
|
||||
proj.weapon_source = self
|
||||
proj.turn_speed = 6.5 # Slower turn radius so they sweep nicely
|
||||
|
||||
proj.position = origin # Start at origin to spread outward around camera
|
||||
proj.logical_source = origin
|
||||
|
||||
# Initial pop-up speed
|
||||
proj.velocity = fire_dir * 5.0
|
||||
if player:
|
||||
proj.velocity += fire_dir * player.velocity.dot(fire_dir)
|
||||
proj.velocity += fire_dir * max(0.0, player.velocity.dot(fire_dir))
|
||||
|
||||
proj.initial_aim_dir = _current_aim_dir
|
||||
proj.cruise_speed = 65.0
|
||||
|
||||
Reference in New Issue
Block a user