Add grass texture and soften world lighting
This commit is contained in:
parent
1dabdd0d23
commit
67d17074b2
8 changed files with 98 additions and 4 deletions
|
|
@ -19,8 +19,13 @@ const FishingShopInteractionType = preload(
|
|||
^"Interactables/PelicanCoolerPerch"
|
||||
)
|
||||
|
||||
@export_group("Grass Surface")
|
||||
@export var grass_material: Material
|
||||
@export_range(0, 16, 1) var grass_surface_index: int = 0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_apply_grass_material()
|
||||
_build_terrain_collision()
|
||||
|
||||
|
||||
|
|
@ -44,6 +49,28 @@ func has_terrain_collision() -> bool:
|
|||
return collision_shape != null and collision_shape.shape != null
|
||||
|
||||
|
||||
func _apply_grass_material() -> void:
|
||||
var visual_mesh: MeshInstance3D = (
|
||||
get_node_or_null(visual_mesh_path) as MeshInstance3D
|
||||
)
|
||||
if visual_mesh == null or visual_mesh.mesh == null:
|
||||
push_error("Starter island visual mesh is unavailable.")
|
||||
return
|
||||
if grass_material == null:
|
||||
push_error("Starter island grass material is unavailable.")
|
||||
return
|
||||
if grass_surface_index >= visual_mesh.mesh.get_surface_count():
|
||||
push_error("Starter island grass surface index is invalid.")
|
||||
return
|
||||
if visual_mesh.mesh.surface_get_name(grass_surface_index) != "grass":
|
||||
push_error("Starter island grass surface name does not match.")
|
||||
return
|
||||
visual_mesh.set_surface_override_material(
|
||||
grass_surface_index,
|
||||
grass_material
|
||||
)
|
||||
|
||||
|
||||
func _build_terrain_collision() -> void:
|
||||
var visual_mesh: MeshInstance3D = (
|
||||
get_node_or_null(visual_mesh_path) as MeshInstance3D
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
[ext_resource type="Script" path="res://world/safe_respawn_point.gd" id="6_safe"]
|
||||
[ext_resource type="PackedScene" path="res://world/interactables/fishing_shop_world.tscn" id="7_shop"]
|
||||
[ext_resource type="PackedScene" path="res://world/interactables/pelican_buyer_world.tscn" id="8_pelican"]
|
||||
[ext_resource type="Material" path="res://world/materials/starter_island_grass.tres" id="9_grass"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="WaterMaterial"]
|
||||
transparency = 1
|
||||
|
|
@ -46,6 +47,7 @@ size = Vector3(11.5, 4.8, 8.5)
|
|||
|
||||
[node name="StarterIslandRegion" type="Node3D"]
|
||||
script = ExtResource("1_region")
|
||||
grass_material = ExtResource("9_grass")
|
||||
region_id = &"starter_island"
|
||||
|
||||
[node name="Visuals" type="Node3D" parent="."]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue