Improved socket script and added hologram logic to show preview of where the pickupable will attach. Also added lock and key meshes.

This commit is contained in:
2026-10-06 20:38:30 +03:00
parent 7267569e6d
commit e6c25cf251
8 changed files with 247 additions and 65 deletions
+10 -4
View File
@@ -14,6 +14,7 @@ class_name Pickupable
@export var maxDistance: float = 4.0
@export var body: RigidBody3D
@export var snapAnchor: Marker3D
@export var visualMeshNode: MeshInstance3D
@export_range(0.01, 1000.0, 0.01) var bodyMass: float = 1.0
@@ -43,7 +44,15 @@ func beginInteract(player, hitPosition: Vector3):
func updateInteract(player):
if !dragging:
return
if Input.is_action_just_pressed("action") and currentSocket != null:
if currentSocket.attachedObject == self:
currentSocket.detachObject()
else:
if currentSocket.attachObject(self):
endInteract(player)
return
body.sleeping = false
# Toggle rotation mode
@@ -117,9 +126,6 @@ func endInteract(player):
rotating = false
player.setMouseFactors(1.0, 1.0)
playerRef = null
if currentSocket != null and currentSocket.isInRange(self):
currentSocket.snapObject(self)
func throw():
if !dragging: