diff --git a/models/props/platform_constructed.blend b/models/props/platform_constructed.blend new file mode 100644 index 0000000..03fc154 Binary files /dev/null and b/models/props/platform_constructed.blend differ diff --git a/models/props/platform_constructed.blend.import b/models/props/platform_constructed.blend.import new file mode 100644 index 0000000..a18a560 --- /dev/null +++ b/models/props/platform_constructed.blend.import @@ -0,0 +1,53 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://dkr18e7uct18e" +path="res://.godot/imported/platform_constructed.blend-acfeda0aef8e23cc81e835d34f55a927.scn" + +[deps] + +source_file="res://models/props/platform_constructed.blend" +dest_files=["res://.godot/imported/platform_constructed.blend-acfeda0aef8e23cc81e835d34f55a927.scn"] + +[params] + +nodes/root_type="" +nodes/root_name="" +nodes/apply_root_scale=true +nodes/root_scale=1.0 +nodes/import_as_skeleton_bones=false +nodes/use_node_type_suffixes=true +meshes/ensure_tangents=true +meshes/generate_lods=true +meshes/create_shadow_meshes=true +meshes/light_baking=1 +meshes/lightmap_texel_size=0.2 +meshes/force_disable_compression=false +skins/use_named_skins=true +animation/import=true +animation/fps=30 +animation/trimming=false +animation/remove_immutable_tracks=true +animation/import_rest_as_RESET=false +import_script/path="" +_subresources={} +blender/nodes/visible=0 +blender/nodes/active_collection_only=false +blender/nodes/punctual_lights=true +blender/nodes/cameras=true +blender/nodes/custom_properties=true +blender/nodes/modifiers=1 +blender/meshes/colors=false +blender/meshes/uvs=true +blender/meshes/normals=true +blender/meshes/export_geometry_nodes_instances=false +blender/meshes/tangents=true +blender/meshes/skins=2 +blender/meshes/export_bones_deforming_mesh_only=false +blender/materials/unpack_enabled=true +blender/materials/export_materials=1 +blender/animation/limit_playback=true +blender/animation/always_sample=true +blender/animation/group_tracks=true diff --git a/models/props/platform_constructed.blend1 b/models/props/platform_constructed.blend1 new file mode 100644 index 0000000..2a618e4 Binary files /dev/null and b/models/props/platform_constructed.blend1 differ diff --git a/models/props/textures/Platform_Constructed_AlbedoTexture.png b/models/props/textures/Platform_Constructed_AlbedoTexture.png new file mode 100644 index 0000000..4b0a850 Binary files /dev/null and b/models/props/textures/Platform_Constructed_AlbedoTexture.png differ diff --git a/models/props/textures/Platform_Constructed_AlbedoTexture.png.import b/models/props/textures/Platform_Constructed_AlbedoTexture.png.import new file mode 100644 index 0000000..b8e6ad5 --- /dev/null +++ b/models/props/textures/Platform_Constructed_AlbedoTexture.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dvuqttbn7p2fn" +path.s3tc="res://.godot/imported/Platform_Constructed_AlbedoTexture.png-3d17f2978411ca1284ca1d059c328fa6.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://models/props/textures/Platform_Constructed_AlbedoTexture.png" +dest_files=["res://.godot/imported/Platform_Constructed_AlbedoTexture.png-3d17f2978411ca1284ca1d059c328fa6.s3tc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/models/props/textures/Platform_Constructed_RoughnessTexture.png b/models/props/textures/Platform_Constructed_RoughnessTexture.png new file mode 100644 index 0000000..c30409f Binary files /dev/null and b/models/props/textures/Platform_Constructed_RoughnessTexture.png differ diff --git a/models/props/textures/Platform_Constructed_RoughnessTexture.png.import b/models/props/textures/Platform_Constructed_RoughnessTexture.png.import new file mode 100644 index 0000000..9d37b45 --- /dev/null +++ b/models/props/textures/Platform_Constructed_RoughnessTexture.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ctc43ugldo7km" +path.s3tc="res://.godot/imported/Platform_Constructed_RoughnessTexture.png-9963302ccb2e73dd0c9033f357283b7e.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://models/props/textures/Platform_Constructed_RoughnessTexture.png" +dest_files=["res://.godot/imported/Platform_Constructed_RoughnessTexture.png-9963302ccb2e73dd0c9033f357283b7e.s3tc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/props/auto_path_follow.gd b/props/auto_path_follow.gd new file mode 100644 index 0000000..70c0a5d --- /dev/null +++ b/props/auto_path_follow.gd @@ -0,0 +1,52 @@ +class_name AutoPathFollow extends PathFollow3D + +@export var speed: float = 1.0 +@export var pause_at_ends: float = 1.0 +@export var body: AnimatableBody3D +@export var area: Area3D + +@onready var _prev_position := global_position +@onready var _area_bodies: Array[Character] = [] + +var direction: float = 1.0 +var pause_timer: float = 0.0 + +func _ready() -> void: + if area: + area.body_entered.connect(_on_area_body_entered) + area.body_exited.connect(_on_area_body_exited) + +func _physics_process(delta: float) -> void: + if pause_timer > 0.0: + pause_timer -= delta + else: + progress += direction*speed*delta + if !loop && ( + (direction > 0.0 && progress_ratio >= 1.0) || + (direction < 0.0 && progress_ratio <= 0.0) + ): + progress_ratio = clamp(progress_ratio, 0.0, 1.0) + direction *= -1.0 + pause_timer = pause_at_ends + var velocity := (global_position - _prev_position).normalized()*speed + _prev_position = global_position + if body: + body.global_position = global_position + body.constant_linear_velocity = velocity + for ch in _area_bodies: + if ch.impetus.is_zero_approx() && ch.is_grounded(): + ch.state = &'idle' + var veldiff := velocity - ch.linear_velocity + veldiff -= veldiff.project(global_basis.y) + ch.apply_central_impulse(ch.mass*veldiff) + +func _on_area_body_entered(pbody: Node3D) -> void: + var ch := pbody as Character + if ch && _area_bodies.count(ch) <= 0: + _area_bodies.push_back(ch) + +func _on_area_body_exited(pbody: Node3D) -> void: + var ch := pbody as Character + if ch: + while _area_bodies.count(ch) > 0: + _area_bodies.erase(ch) diff --git a/props/auto_path_follow.gd.uid b/props/auto_path_follow.gd.uid new file mode 100644 index 0000000..fd9e97e --- /dev/null +++ b/props/auto_path_follow.gd.uid @@ -0,0 +1 @@ +uid://bk4rnp6ytjley diff --git a/props/platform_constructed.tscn b/props/platform_constructed.tscn new file mode 100644 index 0000000..6aeb559 --- /dev/null +++ b/props/platform_constructed.tscn @@ -0,0 +1,34 @@ +[gd_scene load_steps=5 format=3 uid="uid://dsgofpf33wf3c"] + +[ext_resource type="Script" uid="uid://bk4rnp6ytjley" path="res://props/auto_path_follow.gd" id="1_8irhf"] +[ext_resource type="PackedScene" uid="uid://dkr18e7uct18e" path="res://models/props/platform_constructed.blend" id="1_nde2r"] + +[sub_resource type="CylinderShape3D" id="CylinderShape3D_goegf"] +height = 0.196957 +radius = 0.912598 + +[sub_resource type="CylinderShape3D" id="CylinderShape3D_8irhf"] +height = 1.67555 +radius = 0.93457 + +[node name="PlatformConstructed" type="PathFollow3D" node_paths=PackedStringArray("body", "area")] +rotation_mode = 0 +loop = false +script = ExtResource("1_8irhf") +body = NodePath("AnimatableBody3D") +area = NodePath("Area3D") + +[node name="AnimatableBody3D" type="AnimatableBody3D" parent="."] +top_level = true + +[node name="platform_constructed" parent="AnimatableBody3D" instance=ExtResource("1_nde2r")] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="AnimatableBody3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.338884, 0) +shape = SubResource("CylinderShape3D_goegf") + +[node name="Area3D" type="Area3D" parent="."] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.07398, 0) +shape = SubResource("CylinderShape3D_8irhf") diff --git a/test/blender_test_map.tscn b/test/blender_test_map.tscn index efbbcef..3cd400f 100644 --- a/test/blender_test_map.tscn +++ b/test/blender_test_map.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=18 format=3 uid="uid://6wjqqijnie4p"] +[gd_scene load_steps=21 format=3 uid="uid://6wjqqijnie4p"] [ext_resource type="Script" uid="uid://cmoaplk7fly6y" path="res://vfx/gameplay_camera.gd" id="1_qjty2"] [ext_resource type="Texture2D" uid="uid://b334g66yuhwtv" path="res://vfx/textures/skybox1.png" id="2_p5rwy"] @@ -11,6 +11,7 @@ [ext_resource type="Script" uid="uid://dotkfe7cs5010" path="res://test/pick_up_item.gd" id="10_ld4ib"] [ext_resource type="PackedScene" uid="uid://ddga068u8m4i3" path="res://props/speedpad.tscn" id="10_qjty2"] [ext_resource type="PackedScene" uid="uid://img70a34s4vc" path="res://props/speedpad_constructed.tscn" id="11_vhybo"] +[ext_resource type="PackedScene" uid="uid://dsgofpf33wf3c" path="res://props/platform_constructed.tscn" id="12_sj3fr"] [sub_resource type="PanoramaSkyMaterial" id="PanoramaSkyMaterial_sj3fr"] panorama = ExtResource("2_p5rwy") @@ -32,6 +33,20 @@ radius = 0.25 radius = 0.25 height = 0.5 +[sub_resource type="Curve3D" id="Curve3D_bbrum"] +_data = { +"points": PackedVector3Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10.9595, 3.86243, -6.24864, 0, 0, 0, 0, 0, 0, 17.9047, 12.2205, -33.7942), +"tilts": PackedFloat32Array(0, 0, 0) +} +point_count = 3 + +[sub_resource type="Curve3D" id="Curve3D_sj3fr"] +_data = { +"points": PackedVector3Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3.1118, 0, 3.82243, 0, 0, 0, 0, 0, 0, -4.31411, 0, 13.1698), +"tilts": PackedFloat32Array(0, 0, 0) +} +point_count = 3 + [node name="Node3D" type="Node3D"] [node name="Camera3D" type="Camera3D" parent="." node_paths=PackedStringArray("target")] @@ -96,4 +111,18 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 30.1043, 0.0802538, 15.8815) [node name="SpeedpadConstructed" parent="." instance=ExtResource("11_vhybo")] transform = Transform3D(0.696314, 0, -0.717737, 0, 1, 0, 0.717737, 0, 0.696314, -37.1813, 0.0469734, 8.76293) +[node name="Path3D" type="Path3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 11.1829, 35.8037, 44.9246) +curve = SubResource("Curve3D_bbrum") + +[node name="PlatformConstructed" parent="Path3D" instance=ExtResource("12_sj3fr")] +speed = 2.0 + +[node name="Path3D2" type="Path3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.827824, 0) +curve = SubResource("Curve3D_sj3fr") + +[node name="PlatformConstructed2" parent="Path3D2" instance=ExtResource("12_sj3fr")] +speed = 2.0 + [editable path="StaticBody3D/blender_test_map"]