Updating FPS setting to lock to 30. Update cue to ball collision impulse calculations

This commit is contained in:
2026-08-16 05:00:05 -05:00
parent 84509a7f03
commit 8094d4066b
10 changed files with 99 additions and 59 deletions

View File

@@ -2,11 +2,11 @@ class_name PoolCueTip extends Area3D
const MAX_CHARGE_TIME: float = 2.0
const EFFECTIVE_CHARGE: float = 1.2
const DEAD_TIME: float = 0.18 # seconds (tweak 0.1 0.18)
const EFFECTIVE_CHARGE: float = 1.8
const DEAD_TIME: float = 0.2
const MIN_FORCE: float = 0.03
const MAX_FORCE: float = 1.4
const MIN_FORCE: float = 0.2
const MAX_FORCE: float = 2.0
var anim_pos: float = 0.0
var impulse: Vector3 = Vector3.ZERO
@@ -18,12 +18,12 @@ func _on_body_entered(body: Node) -> void:
var usable = min(anim_pos - DEAD_TIME, EFFECTIVE_CHARGE)
var time = usable / EFFECTIVE_CHARGE
var direction = -global_transform.basis.z
time = pow(time, 0.6)
time = pow(time, 2)
impulse = lerp(MIN_FORCE, MAX_FORCE, time) * direction
body.apply_impulse(
impulse,
body.global_position - $shape.global_position
$shape.global_position - body.global_position
)
#body.apply_central_impulse(impulse)