Proprerties of children?

Godot Version

4.7

Question

I have a scene with a rigid body 3d that I am using in my main scene by instancing them during runtime, is there a way to accesses and change that child’s properties at a different time in game? im trying to freeze the children some time after they have been placed by the player. here is the code in a script attached to main

		if Global.rock_subtype == 1:
			child_numb = 5
			for i in range(child_numb):
				var rock_temp = preload("res://scenes/physics-objects/rock.tscn").instantiate()
				rock_temp.position = Vector3(randi_range(1, -1), randi_range(1, -1), randi_range(1, -1))
				rock_temp.scale = Vector3(randf_range(0.2, 1.3), randf_range(0.2, 1.3), randf_range(0.2, 1.3))
				add_child(rock_temp)

and here is the rock scene, i tried freezing the rocks in the script attached to the root of the rock scene but it only freezes new instances. id really love some help and direction, thanks!

Declare rock_temp (with a better name) as a script property, outside of any function. It will then permanently contain a reference to the instantiated node after you assign it.

thanks, this is making a lot more sense

If you want to access any of its children, you can use get_node() with a relative path:

rock_temp.get_node("RigidBody3D")

or

rock_temp.get_node("RigidBody3D/MeshInstance3D")