From 51a0664a1c2265adddbf4c42d4eda747c8ea8aaf Mon Sep 17 00:00:00 2001 From: dusoleil Date: Mon, 19 Sep 2022 10:32:24 -0400 Subject: Add Levels of Detail per Chunk --- world/obstacles/Rock.gd | 18 ------------------ world/obstacles/Rock.tscn | 32 -------------------------------- world/obstacles/Rock_coll.tres | 4 ++++ world/obstacles/Rock_lowres_mesh.tres | 4 ++++ 4 files changed, 8 insertions(+), 50 deletions(-) delete mode 100644 world/obstacles/Rock.gd delete mode 100644 world/obstacles/Rock.tscn create mode 100644 world/obstacles/Rock_coll.tres create mode 100644 world/obstacles/Rock_lowres_mesh.tres (limited to 'world/obstacles') diff --git a/world/obstacles/Rock.gd b/world/obstacles/Rock.gd deleted file mode 100644 index 577e626..0000000 --- a/world/obstacles/Rock.gd +++ /dev/null @@ -1,18 +0,0 @@ -extends StaticBody - -onready var collision_enabled = self.collision_layer - -func lod_distance(): - $"MeshInstance".visible = false - $"MeshInstance2".visible = true - self.collision_layer = 0 - -func lod_mid(): - $"MeshInstance".visible = true - $"MeshInstance2".visible = false - self.collision_layer = 0 - -func lod_close(): - $"MeshInstance".visible = true - $"MeshInstance2".visible = false - self.collision_layer = collision_enabled diff --git a/world/obstacles/Rock.tscn b/world/obstacles/Rock.tscn deleted file mode 100644 index 819e9a8..0000000 --- a/world/obstacles/Rock.tscn +++ /dev/null @@ -1,32 +0,0 @@ -[gd_scene load_steps=7 format=2] - -[ext_resource path="res://world/obstacles/Rock.gd" type="Script" id=1] -[ext_resource path="res://world/chunk/helper/ChunkedMeshInstance.gd" type="Script" id=2] -[ext_resource path="res://world/obstacles/Rock_mesh.tres" type="PrismMesh" id=3] -[ext_resource path="res://world/obstacles/Rock_mat.tres" type="Material" id=4] - -[sub_resource type="ConvexPolygonShape" id=2] -points = PoolVector3Array( 2.5, -5, 2.5, 2.5, -5, -2.5, -2.5, -5, -2.5, -2.5, -5, 2.5, 0, 5, 2.5, 0, 5, -2.5 ) - -[sub_resource type="CubeMesh" id=9] -size = Vector3( 5, 10, 5 ) - -[node name="Rock" type="StaticBody"] -collision_layer = 8 -collision_mask = 0 -script = ExtResource( 1 ) - -[node name="CollisionShape" type="CollisionShape" parent="."] -shape = SubResource( 2 ) - -[node name="MeshInstance" type="MeshInstance" parent="."] -visible = false -material_override = ExtResource( 4 ) -script = ExtResource( 2 ) -_mesh = ExtResource( 3 ) - -[node name="MeshInstance2" type="MeshInstance" parent="."] -visible = false -material_override = ExtResource( 4 ) -script = ExtResource( 2 ) -_mesh = SubResource( 9 ) diff --git a/world/obstacles/Rock_coll.tres b/world/obstacles/Rock_coll.tres new file mode 100644 index 0000000..b06d080 --- /dev/null +++ b/world/obstacles/Rock_coll.tres @@ -0,0 +1,4 @@ +[gd_resource type="ConvexPolygonShape" format=2] + +[resource] +points = PoolVector3Array( 2.5, -5, 2.5, 2.5, -5, -2.5, -2.5, -5, -2.5, -2.5, -5, 2.5, 0, 5, 2.5, 0, 5, -2.5 ) diff --git a/world/obstacles/Rock_lowres_mesh.tres b/world/obstacles/Rock_lowres_mesh.tres new file mode 100644 index 0000000..910d7f6 --- /dev/null +++ b/world/obstacles/Rock_lowres_mesh.tres @@ -0,0 +1,4 @@ +[gd_resource type="CubeMesh" format=2] + +[resource] +size = Vector3( 5, 10, 5 ) -- cgit v1.2.3