diff --git a/island/Island.tscn b/island/Island.tscn index da04812..bdc67b4 100644 --- a/island/Island.tscn +++ b/island/Island.tscn @@ -82,16 +82,20 @@ transform = Transform3D(1, 0, 0, 0, -0.337161, 0.941447, 0, -0.941447, -0.337161 [node name="Player" parent="." instance=ExtResource("3_5378m")] transform = Transform3D(-1, 3.48787e-16, -8.74228e-08, 3.48787e-16, 1, -3.48787e-16, 8.74228e-08, -3.48787e-16, -1, 0, 4.89631, 0) -[node name="CropTile" parent="." instance=ExtResource("8_4ooup")] +[node name="CropTiles" type="Node3D" parent="."] + +[node name="CropTile" parent="CropTiles" instance=ExtResource("8_4ooup")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 2, 8) debug_growth = true -[node name="CropTile2" parent="." instance=ExtResource("8_4ooup")] +[node name="CropTile2" parent="CropTiles" instance=ExtResource("8_4ooup")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 8) debug_growth = true debug_growth_offset = 0.5 -[node name="CropTile3" parent="." instance=ExtResource("8_4ooup")] +[node name="CropTile3" parent="CropTiles" instance=ExtResource("8_4ooup")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 2, 8) debug_growth = true debug_growth_offset = 0.6 + +[node name="Produce" type="Node3D" parent="."] diff --git a/island/Pineapple.tscn b/island/Pineapple.tscn index a0ae042..40bdfd7 100644 --- a/island/Pineapple.tscn +++ b/island/Pineapple.tscn @@ -13,6 +13,7 @@ radius = 3.0 [node name="Pineapple" type="RigidBody3D"] collision_layer = 2 +collision_mask = 3 lock_rotation = true linear_damp = 1.0 diff --git a/island/Producer.gd b/island/Producer.gd index 8bd6e16..2c927fa 100644 --- a/island/Producer.gd +++ b/island/Producer.gd @@ -3,6 +3,7 @@ extends Node3D @export var produce_scene: PackedScene = preload("res://island/Pineapple.tscn") +@onready var produce_container: Node3D = get_tree().root.find_child("Produce", true, false) var rng: RandomNumberGenerator @@ -14,5 +15,6 @@ func _ready(): func produce_with_random_force(): # TODO: Not sure it's a good idea attaching produce to the crop var produce: RigidBody3D = produce_scene.instantiate() - add_child(produce) + produce.position = global_position + produce_container.add_child(produce) produce.apply_impulse(Vector3.UP * rng.randf_range(15.0, 25.0))