1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-06-08 20:57:13 +08:00

fix: 添加引力属性并优化掉落物收集逻辑

This commit is contained in:
2025-09-06 18:08:11 +08:00
parent 8289b8c273
commit 850189e15a
3 changed files with 13 additions and 9 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ func _physics_process(_delta):
linear_velocity = Vector2.ZERO
else:
var direction = (targetPlayer.position - position).normalized()
var speed = 10000.0 / ((targetPlayer.position - position).length() ** (1 / 3.0))
var speed = 1000.0 * targetPlayer.fields.get(FieldStore.Entity.GRAVITY) / ((targetPlayer.position - position).length() ** (1 / 3.0))
apply_central_force(direction * speed)
angular_velocity = linear_velocity.length() ** (1.0 / 2.25) # 角速度=线速度的2.25次根号
if position.distance_to(targetPlayer.position) < targetPlayer.fields.get(FieldStore.Entity.DROPPED_ITEM_COLLECT_RADIUS):