Feat/3 adding playermodel #8
@@ -89,10 +89,9 @@ func _die(_hit_position: Vector3, source: Node, damage_amount: float) -> void:
|
|||||||
var impulse = Vector3.ZERO
|
var impulse = Vector3.ZERO
|
||||||
|
|
||||||
if pending_impulse.length_squared() > 0.01:
|
if pending_impulse.length_squared() > 0.01:
|
||||||
# The player treats incoming impulses as direct velocity additions (v += impulse)
|
# Scale down the massive direct impulse values to reasonable ragdoll velocities
|
||||||
# To make the dummy fly exactly like the player, we must use it as base linear velocity!
|
linear_vel = pending_impulse * 0.25
|
||||||
linear_vel = pending_impulse
|
impulse = pending_impulse * 0.2
|
||||||
impulse = pending_impulse * 0.5
|
|
||||||
pending_impulse = Vector3.ZERO
|
pending_impulse = Vector3.ZERO
|
||||||
else:
|
else:
|
||||||
var hit_dir = Vector3.BACK
|
var hit_dir = Vector3.BACK
|
||||||
@@ -103,8 +102,8 @@ func _die(_hit_position: Vector3, source: Node, damage_amount: float) -> void:
|
|||||||
if cam:
|
if cam:
|
||||||
hit_dir = (_hit_position - cam.global_position).normalized()
|
hit_dir = (_hit_position - cam.global_position).normalized()
|
||||||
|
|
||||||
linear_vel = hit_dir * (damage_amount * 0.05)
|
linear_vel = hit_dir * (damage_amount * 0.02)
|
||||||
impulse = hit_dir * (damage_amount * 1.5)
|
impulse = hit_dir * (damage_amount * 0.5)
|
||||||
|
|
||||||
get_tree().create_timer(0.01).timeout.connect(func():
|
get_tree().create_timer(0.01).timeout.connect(func():
|
||||||
if is_instance_valid(ragdoll_instance):
|
if is_instance_valid(ragdoll_instance):
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ func _shoot_hitscan() -> void:
|
|||||||
damage = lerpf(base_dmg, min_dmg, falloff_factor)
|
damage = lerpf(base_dmg, min_dmg, falloff_factor)
|
||||||
|
|
||||||
if result.collider.has_method("apply_impulse"):
|
if result.collider.has_method("apply_impulse"):
|
||||||
result.collider.apply_impulse(pellet_dir * 8.0) # Apply strong physical force for ragdoll
|
result.collider.apply_impulse(pellet_dir * 2.5) # Apply strong physical force for ragdoll
|
||||||
|
|
||||||
if result.collider.has_method("take_damage"):
|
if result.collider.has_method("take_damage"):
|
||||||
result.collider.take_damage(damage, result.position, player)
|
result.collider.take_damage(damage, result.position, player)
|
||||||
|
|||||||
Reference in New Issue
Block a user