@export rigidbody3D not updating in inspector at runtime

Godot Version

v4.3

Question

I’m new to Godot and not sure what i’m doing wrong here.

even though my print says tether_target has a value. it does not show up in the inspector view,

tether_target is using the @export, it shows up in the inspector, but does not update even though my print command says it has. I am in remote view during playmode.

extends StaticBody3D

# Tether Properties
@export var tether_range: float = 3.0

@export var tether_target: RigidBody3D = null

@onready var tether_joint: Generic6DOFJoint3D = $TetherJoint

func _ready() -> void:
	tether_joint.node_a = get_path()
	tether_joint.node_b = ""

func _process(delta: float) -> void:
	FindNearestTetherableObject()

func _physics_process(delta: float) -> void:
	pass

func FindNearestTetherableObject():
	# Find the closest tetherable object
	var min_distance = INF
	
	if current_tethered == null:
		for object in get_tree().get_nodes_in_group("tetherable"):
			var distance = self.global_transform.origin.distance_to(object.global_transform.origin)
			
			if distance <= tether_range and distance < min_distance:								
				# Update tether_target to the new closest target
				min_distance = distance  # Set the new min_distance
				tether_target = object

				print("Tether Target = ", tether_target.name)
				
	# If tether_target is out of tether_range, it's no longer an eligible tether_target
	if tether_target != null:
		var distance = global_position.distance_to(tether_target.global_position)
		if distance > tether_range:
			tether_target = null

It could be setting it to null when target is out of range.

1 Like

Thanks, I actually figured it out. if you look in the image it’s actually tracking it properly in members.

I think I’m coming from unity and expecting things to work the same…

thats on me

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.