commit d7302501f0a1e2dce9db8d5bf11f8208c5a513f6 Author: Rendo Date: Wed Nov 12 11:44:16 2025 +0500 Initial commit diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f28239b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,4 @@ +root = true + +[*] +charset = utf-8 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8ad74f7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0af181c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Godot 4+ specific ignores +.godot/ +/android/ diff --git a/assets/materials/glass.tres b/assets/materials/glass.tres new file mode 100644 index 0000000..36e5646 --- /dev/null +++ b/assets/materials/glass.tres @@ -0,0 +1,7 @@ +[gd_resource type="ORMMaterial3D" format=3 uid="uid://glk2rfkn4vcu"] + +[resource] +transparency = 4 +cull_mode = 2 +albedo_color = Color(1, 1, 1, 0.3882353) +clearcoat_enabled = true diff --git a/assets/materials/glass_std.tres b/assets/materials/glass_std.tres new file mode 100644 index 0000000..cf4e45e --- /dev/null +++ b/assets/materials/glass_std.tres @@ -0,0 +1,7 @@ +[gd_resource type="StandardMaterial3D" format=3 uid="uid://be2l68by8md8t"] + +[resource] +transparency = 4 +cull_mode = 2 +albedo_color = Color(1, 1, 1, 0.2784314) +clearcoat_enabled = true diff --git a/assets/models/flask.glb b/assets/models/flask.glb new file mode 100644 index 0000000..9ef369c Binary files /dev/null and b/assets/models/flask.glb differ diff --git a/assets/models/flask.glb.import b/assets/models/flask.glb.import new file mode 100644 index 0000000..acc6504 --- /dev/null +++ b/assets/models/flask.glb.import @@ -0,0 +1,49 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://cybcaqajfr5jx" +path="res://.godot/imported/flask.glb-2126b3646c073a6ae7a51eae46cf2a4b.scn" + +[deps] + +source_file="res://assets/models/flask.glb" +dest_files=["res://.godot/imported/flask.glb-2126b3646c073a6ae7a51eae46cf2a4b.scn"] + +[params] + +nodes/root_type="" +nodes/root_name="" +nodes/root_script=null +nodes/apply_root_scale=true +nodes/root_scale=1.0 +nodes/import_as_skeleton_bones=false +nodes/use_name_suffixes=true +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="" +materials/extract=0 +materials/extract_format=0 +materials/extract_path="" +_subresources={ +"materials": { +"@MATERIAL:0": { +"use_external/enabled": true, +"use_external/path": "uid://glk2rfkn4vcu" +} +} +} +gltf/naming_version=2 +gltf/embedded_image_handling=1 diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..c6bbb7d --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..39e33cb --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bdyc1cwthn845" +path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.svg" +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..0e074f1 --- /dev/null +++ b/project.godot @@ -0,0 +1,28 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=5 + +[application] + +config/name="lab-electrolyte" +run/main_scene="uid://c7r4rhgj3ucao" +config/features=PackedStringArray("4.5", "Mobile") +config/icon="res://icon.svg" + +[input] + +drag_camera={ +"deadzone": 0.2, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":2,"position":Vector2(641, 3),"global_position":Vector2(650, 51),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null) +] +} + +[rendering] + +renderer/rendering_method="mobile" diff --git a/scenes/draggable_object.tscn b/scenes/draggable_object.tscn new file mode 100644 index 0000000..f003b23 --- /dev/null +++ b/scenes/draggable_object.tscn @@ -0,0 +1,27 @@ +[gd_scene load_steps=5 format=3 uid="uid://bjxjcx2qu16q5"] + +[ext_resource type="Script" uid="uid://bjnv2g1ni0525" path="res://src/draggable_object.gd" id="1_vcwhe"] + +[sub_resource type="SphereShape3D" id="SphereShape3D_vcwhe"] +radius = 0.49570328 + +[sub_resource type="SphereShape3D" id="SphereShape3D_18ddp"] +radius = 0.25 + +[sub_resource type="SphereMesh" id="SphereMesh_18ddp"] +radius = 0.25 +height = 0.5 + +[node name="DraggableObject" type="Area3D"] +script = ExtResource("1_vcwhe") + +[node name="DragShape" type="CollisionShape3D" parent="."] +shape = SubResource("SphereShape3D_vcwhe") + +[node name="DragArea" type="Area3D" parent="."] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="DragArea"] +shape = SubResource("SphereShape3D_18ddp") + +[node name="MeshInstance3D" type="MeshInstance3D" parent="."] +mesh = SubResource("SphereMesh_18ddp") diff --git a/scenes/lab.tscn b/scenes/lab.tscn new file mode 100644 index 0000000..9b87706 --- /dev/null +++ b/scenes/lab.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=4 format=3 uid="uid://c7r4rhgj3ucao"] + +[ext_resource type="PackedScene" uid="uid://bjxjcx2qu16q5" path="res://scenes/draggable_object.tscn" id="1_bb6uc"] +[ext_resource type="Script" uid="uid://crjao0jjv5yqs" path="res://src/draggable_camera.gd" id="1_hem3r"] + +[sub_resource type="BoxMesh" id="BoxMesh_cbcd7"] +size = Vector3(3.535, 1, 1) + +[node name="Lab" type="Node3D"] + +[node name="MeshInstance3D" type="MeshInstance3D" parent="."] +mesh = SubResource("BoxMesh_cbcd7") + +[node name="Camera3D" type="Camera3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.236948, 0.9448395, 1.8294222) +script = ExtResource("1_hem3r") + +[node name="DraggableObject" parent="." instance=ExtResource("1_bb6uc")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.236948, 0.9448395, 0.0039073825) + +[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 0.8403207, 0.5420896, 0, -0.5420896, 0.8403207, 0, 1.9293891, 0) diff --git a/src/draggable_camera.gd b/src/draggable_camera.gd new file mode 100644 index 0000000..2564f07 --- /dev/null +++ b/src/draggable_camera.gd @@ -0,0 +1,7 @@ +extends Camera3D + +const SENSITIVITY = 0.05 + +func _input(event: InputEvent) -> void: + if Input.is_action_pressed("drag_camera") and event is InputEventMouseMotion: + global_position += get_ * Vector3(event.relative.x,event.relative.y,0) diff --git a/src/draggable_camera.gd.uid b/src/draggable_camera.gd.uid new file mode 100644 index 0000000..3c32899 --- /dev/null +++ b/src/draggable_camera.gd.uid @@ -0,0 +1 @@ +uid://crjao0jjv5yqs diff --git a/src/draggable_object.gd b/src/draggable_object.gd new file mode 100644 index 0000000..5f25b4b --- /dev/null +++ b/src/draggable_object.gd @@ -0,0 +1,23 @@ +extends Area3D + + +var mouse_in: bool = false +var dragged: bool = false + +func _mouse_enter() -> void: + mouse_in = true + +func _mouse_exit() -> void: + mouse_in = false + dragged = false + +func _process(delta: float) -> void: + if dragged == false: + return + var camera: Camera3D = get_viewport().get_camera_3d() + var new_position: Vector3 = camera.project_position(get_viewport().get_mouse_position(),(-camera.basis.z).dot(camera.to_local(global_position))) + global_position = new_position + +func _input(event: InputEvent) -> void: + if mouse_in and event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT: + dragged = true if event.pressed else false diff --git a/src/draggable_object.gd.uid b/src/draggable_object.gd.uid new file mode 100644 index 0000000..cb4f9d3 --- /dev/null +++ b/src/draggable_object.gd.uid @@ -0,0 +1 @@ +uid://bjnv2g1ni0525