diff --git a/island/CropTile.tscn b/island/CropTile.tscn index 0a7d3d3..a897414 100644 --- a/island/CropTile.tscn +++ b/island/CropTile.tscn @@ -32,8 +32,8 @@ script = ExtResource("2_jejoo") [node name="Plant" type="Area3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, 0, 0.5) -collision_layer = 0 -collision_mask = 16 +collision_layer = 16 +collision_mask = 0 [node name="PlantableArea" type="CollisionShape3D" parent="Plant"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.05, 0) diff --git a/island/HillMesh.tscn b/island/HillMesh.tscn index 960d3f5..050096c 100644 --- a/island/HillMesh.tscn +++ b/island/HillMesh.tscn @@ -25,6 +25,7 @@ mesh = SubResource("ArrayMesh_s0thi") skeleton = NodePath("../..") [node name="StaticBody3D" type="StaticBody3D" parent="."] +collision_layer = 9 [node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D"] shape = SubResource("ConcavePolygonShape3D_0ox82") diff --git a/island/IslandMesh.tscn b/island/IslandMesh.tscn index 5af12af..13f8af9 100644 --- a/island/IslandMesh.tscn +++ b/island/IslandMesh.tscn @@ -24,6 +24,7 @@ mesh = SubResource("ArrayMesh_nmvk4") skeleton = NodePath("../..") [node name="StaticBody3D" type="StaticBody3D" parent="."] +collision_layer = 9 [node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D"] shape = SubResource("ConcavePolygonShape3D_o3dws") diff --git a/player/onhand/PeaShooter.gd b/player/onhand/PeaShooter.gd index 7523d67..1b14dab 100644 --- a/player/onhand/PeaShooter.gd +++ b/player/onhand/PeaShooter.gd @@ -53,11 +53,14 @@ func shoot() -> void: func try_placing_seed(ray: RayCast3D) -> bool: var point = ray.get_collision_point() as Vector3 var normal = ray.get_collision_normal() as Vector3 - var obj = ray.get_collider() as Node3D - print(point, normal, obj.name) + var coll = ray.get_collider() as CollisionObject3D if normal != Vector3(0,1,0): print("Not horizontal, no plant for you :<") return false + + if coll.collision_layer == 0b10000: + print("Colliding with planted seed, not planting again") + return false var correct_point = point.floor() var crop = croptile.instantiate() as CropTile diff --git a/player/onhand/PeaShooter.tscn b/player/onhand/PeaShooter.tscn index dffda64..547e03e 100644 --- a/player/onhand/PeaShooter.tscn +++ b/player/onhand/PeaShooter.tscn @@ -8,3 +8,5 @@ script = ExtResource("1_bl35a") [node name="RayCast3D" type="RayCast3D" parent="."] target_position = Vector3(1000, 0, 0) +collision_mask = 24 +collide_with_areas = true