extends RigidBody3D const SPREAD_PIECES := 4 const SPREAD_POWER := 350 @onready var pieces_index := [0,1,2,3] # Called when the node enters the scene tree for the first time. func _ready() -> void: pieces_index.shuffle() for pieces in range(SPREAD_PIECES): var piece_index : int = pieces_index[pieces] var piece : RigidBody3D = get_child(piece_index) piece.show() piece.freeze = false piece.sleeping = false piece.set_colision_mask_value(2, true) var rand_direction = (Vector3.ONE * 0.25) - Vector3(randf(),randf(), randf()) piece.apply_force(rand_direction * SPREAD_POWER, rand_direction) # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: freeze = true