diff --git a/models/props/springboard.blend b/models/props/springboard.blend new file mode 100644 index 0000000..0b8bdd2 Binary files /dev/null and b/models/props/springboard.blend differ diff --git a/models/props/springboard.blend.import b/models/props/springboard.blend.import new file mode 100644 index 0000000..f1a19ba --- /dev/null +++ b/models/props/springboard.blend.import @@ -0,0 +1,53 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://bpmaey501pcll" +path="res://.godot/imported/springboard.blend-acacfa8456b72ac481630e2f401f5645.scn" + +[deps] + +source_file="res://models/props/springboard.blend" +dest_files=["res://.godot/imported/springboard.blend-acacfa8456b72ac481630e2f401f5645.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/springboard.blend1 b/models/props/springboard.blend1 index a67f78d..a7fbbe1 100644 Binary files a/models/props/springboard.blend1 and b/models/props/springboard.blend1 differ diff --git a/models/props/textures/Springboard_Artificial_AlbedoTexture.png b/models/props/textures/Springboard_Artificial_AlbedoTexture.png new file mode 100644 index 0000000..616e70d Binary files /dev/null and b/models/props/textures/Springboard_Artificial_AlbedoTexture.png differ diff --git a/models/props/textures/Springboard_Artificial_AlbedoTexture.png.import b/models/props/textures/Springboard_Artificial_AlbedoTexture.png.import new file mode 100644 index 0000000..4244fb7 --- /dev/null +++ b/models/props/textures/Springboard_Artificial_AlbedoTexture.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b55x3dchqfk6v" +path.s3tc="res://.godot/imported/Springboard_Artificial_AlbedoTexture.png-20efb8f05bae03d38508094a01a0dc63.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://models/props/textures/Springboard_Artificial_AlbedoTexture.png" +dest_files=["res://.godot/imported/Springboard_Artificial_AlbedoTexture.png-20efb8f05bae03d38508094a01a0dc63.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/Springboard_Artificial_EmissionTexture.png b/models/props/textures/Springboard_Artificial_EmissionTexture.png new file mode 100644 index 0000000..4cf95aa Binary files /dev/null and b/models/props/textures/Springboard_Artificial_EmissionTexture.png differ diff --git a/models/props/textures/Springboard_Artificial_EmissionTexture.png.import b/models/props/textures/Springboard_Artificial_EmissionTexture.png.import new file mode 100644 index 0000000..3632a77 --- /dev/null +++ b/models/props/textures/Springboard_Artificial_EmissionTexture.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://daox2kfee1xqf" +path.s3tc="res://.godot/imported/Springboard_Artificial_EmissionTexture.png-7fba51e53a50b2d6e333c61dd4ce8ffa.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://models/props/textures/Springboard_Artificial_EmissionTexture.png" +dest_files=["res://.godot/imported/Springboard_Artificial_EmissionTexture.png-7fba51e53a50b2d6e333c61dd4ce8ffa.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/Springboard_Artificial_MetallicityTexture.png b/models/props/textures/Springboard_Artificial_MetallicityTexture.png new file mode 100644 index 0000000..7cb06e5 Binary files /dev/null and b/models/props/textures/Springboard_Artificial_MetallicityTexture.png differ diff --git a/models/props/textures/Springboard_Artificial_MetallicityTexture.png.import b/models/props/textures/Springboard_Artificial_MetallicityTexture.png.import new file mode 100644 index 0000000..be85f3f --- /dev/null +++ b/models/props/textures/Springboard_Artificial_MetallicityTexture.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://beksp3wbsjhy6" +path="res://.godot/imported/Springboard_Artificial_MetallicityTexture.png-910f21fced471019d7a978c51d2f481a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://models/props/textures/Springboard_Artificial_MetallicityTexture.png" +dest_files=["res://.godot/imported/Springboard_Artificial_MetallicityTexture.png-910f21fced471019d7a978c51d2f481a.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +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=1 diff --git a/models/props/textures/Springboard_Artificial_RoughnessTexture.png b/models/props/textures/Springboard_Artificial_RoughnessTexture.png new file mode 100644 index 0000000..abfd8ec Binary files /dev/null and b/models/props/textures/Springboard_Artificial_RoughnessTexture.png differ diff --git a/models/props/textures/Springboard_Artificial_RoughnessTexture.png.import b/models/props/textures/Springboard_Artificial_RoughnessTexture.png.import new file mode 100644 index 0000000..7603e0b --- /dev/null +++ b/models/props/textures/Springboard_Artificial_RoughnessTexture.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cdsu2ipy1s7s5" +path.s3tc="res://.godot/imported/Springboard_Artificial_RoughnessTexture.png-37aefb6d0eca678c20d547cb66829e5b.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://models/props/textures/Springboard_Artificial_RoughnessTexture.png" +dest_files=["res://.godot/imported/Springboard_Artificial_RoughnessTexture.png-37aefb6d0eca678c20d547cb66829e5b.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/springboard.gd b/props/springboard.gd index 97da82a..306a026 100644 --- a/props/springboard.gd +++ b/props/springboard.gd @@ -1,25 +1,44 @@ class_name Springboard extends Area3D -@export var launch_speed: float = 10.0 +@export var launch_speed: float = 20.0 +@export var model: MeshInstance3D @export var audio_player: AudioStreamPlayer3D func _ready() -> void: body_entered.connect(_on_body_entered) +func _set_boing(boing: float) -> void: + var success := false + if model: + var i: int = model.find_blend_shape_by_name(&'boing') + if i >= 0: + success = true + model.set_blend_shape_value(i, boing) + if !success: + scale.y = 1.0 + boing + +func _get_boing() -> float: + if model: + var i: int = model.find_blend_shape_by_name(&'boing') + if i >= 0: + return model.get_blend_shape_value(i) + return scale.y - 1.0 + func _on_body_entered(body: PhysicsBody3D) -> void: var rbody := body as RigidBody3D var ch := body as Character if rbody: - scale.y = 2.0 + _set_boing(1.0) + var dir := global_basis.y.normalized() rbody.apply_central_impulse(rbody.mass*( - launch_speed*global_basis.y - - rbody.linear_velocity.project(global_basis.y) + launch_speed*dir - + rbody.linear_velocity.project(dir) )) if ch: - ch.ground_normal = global_basis.y + ch.ground_normal = dir ch.soft_force_change_state(&'launch') else: audio_player.play() func _physics_process(delta: float) -> void: - scale.y = lerp(scale.y, 1.0, 1.0 - 0.01**delta) + _set_boing(lerp(_get_boing(), 0.0, 1.0 - 0.01**delta)) diff --git a/props/springboard.tscn b/props/springboard.tscn new file mode 100644 index 0000000..3f2d6e9 --- /dev/null +++ b/props/springboard.tscn @@ -0,0 +1,26 @@ +[gd_scene load_steps=5 format=3 uid="uid://domyuyn24tghm"] + +[ext_resource type="Script" uid="uid://dnjxujqbouc5j" path="res://props/springboard.gd" id="1_67v3t"] +[ext_resource type="PackedScene" uid="uid://bpmaey501pcll" path="res://models/props/springboard.blend" id="2_jhsy2"] +[ext_resource type="AudioStream" uid="uid://dujgina4at6ef" path="res://audio/springboard.ogg" id="3_jhsy2"] + +[sub_resource type="BoxShape3D" id="BoxShape3D_jhsy2"] +size = Vector3(0.5, 0.4, 0.5) + +[node name="Springboard" type="Area3D" node_paths=PackedStringArray("model", "audio_player")] +script = ExtResource("1_67v3t") +model = NodePath("springboard/Springboard") +audio_player = NodePath("AudioStreamPlayer3D") +metadata/_custom_type_script = "uid://dnjxujqbouc5j" + +[node name="springboard" parent="." instance=ExtResource("2_jhsy2")] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.2, 0) +shape = SubResource("BoxShape3D_jhsy2") + +[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="."] +stream = ExtResource("3_jhsy2") +bus = &"Sound Effects" + +[editable path="springboard"] diff --git a/test/blender_test_map.tscn b/test/blender_test_map.tscn index 59e4e26..4e07b31 100644 --- a/test/blender_test_map.tscn +++ b/test/blender_test_map.tscn @@ -1,11 +1,12 @@ -[gd_scene load_steps=15 format=3 uid="uid://6wjqqijnie4p"] +[gd_scene load_steps=16 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"] [ext_resource type="PackedScene" uid="uid://cp3qagrsuarl5" path="res://test/blender_test_map.blend" id="2_vhybo"] [ext_resource type="PackedScene" uid="uid://gis0gxap8i8t" path="res://test/test_stick.tscn" id="3_sj3fr"] [ext_resource type="Material" uid="uid://d31ewanq2qup5" path="res://maps/textures/metal6.tres" id="4_p5rwy"] -[ext_resource type="PackedScene" uid="uid://b7mqd4ps8e3uj" path="res://props/springboard_constructed.tscn" id="8_p5rwy"] +[ext_resource type="PackedScene" uid="uid://domyuyn24tghm" path="res://props/springboard.tscn" id="8_p5rwy"] +[ext_resource type="PackedScene" uid="uid://b7mqd4ps8e3uj" path="res://props/springboard_constructed.tscn" id="9_4tub8"] [ext_resource type="Script" uid="uid://16os114krms3" path="res://characters/controllers/player_character_controller.gd" id="9_j70wf"] [ext_resource type="Script" uid="uid://dotkfe7cs5010" path="res://test/pick_up_item.gd" id="10_ld4ib"] @@ -75,13 +76,16 @@ character = NodePath("..") camera = NodePath("../../Camera3D") metadata/_custom_type_script = "uid://16os114krms3" -[node name="Springboard" parent="." instance=ExtResource("8_p5rwy")] +[node name="Springboard" parent="." instance=ExtResource("9_4tub8")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 32.9914, 0.0113316, 20.8191) -[node name="Springboard2" parent="." instance=ExtResource("8_p5rwy")] +[node name="Springboard2" parent="." instance=ExtResource("9_4tub8")] transform = Transform3D(0.641798, 0.25518, -0.723173, 1.86265e-09, 0.943014, 0.332754, 0.766874, -0.213561, 0.605224, -37.1376, 16.3488, 1.40747) -[node name="Springboard3" parent="." instance=ExtResource("8_p5rwy")] +[node name="Springboard3" parent="." instance=ExtResource("9_4tub8")] transform = Transform3D(0.555329, -0.584704, 0.59138, 0.725086, 0.688658, 0, -0.407259, 0.428801, 0.806393, -29.0464, 2.47059, -35.0708) +[node name="Springboard4" parent="." instance=ExtResource("8_p5rwy")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 30.3396, 6.38962e-05, 2.86398) + [editable path="StaticBody3D/blender_test_map"]