substance solid

This commit is contained in:
Rendo 2025-12-05 10:44:53 +05:00
commit d520e5f67e
8 changed files with 67 additions and 8 deletions

Binary file not shown.

BIN
assets/textures/solid.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 KiB

View file

@ -0,0 +1,41 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cw3jw8qbvj3fv"
path.s3tc="res://.godot/imported/solid.png-8966cbc3b9a90d3d5f9d92a3499b8110.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/textures/solid.png"
dest_files=["res://.godot/imported/solid.png-8966cbc3b9a90d3d5f9d92a3499b8110.s3tc.ctex"]
[params]
compress/mode=2
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=true
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=0

View file

@ -24,9 +24,6 @@ script = ExtResource("1_hem3r")
[node name="Flask" parent="." instance=ExtResource("1_bb6uc")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.6518283, 1.0920403, 0.0039073825)
[node name="Flask2" parent="." instance=ExtResource("1_bb6uc")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.542716, 1.0920403, 0.20219529)
[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)
shadow_enabled = true

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=10 format=3 uid="uid://cw6v8kbi76qak"]
[gd_scene load_steps=12 format=3 uid="uid://cw6v8kbi76qak"]
[ext_resource type="Script" uid="uid://bjnv2g1ni0525" path="res://src/drag/draggable_object.gd" id="1_o7vug"]
[ext_resource type="ArrayMesh" uid="uid://dddqboph2ygmw" path="res://assets/meshes/jar.res" id="2_o7vug"]
@ -6,6 +6,10 @@
[ext_resource type="Script" uid="uid://e8xu57ewvb5a" path="res://src/interactible/proximity_rotator.gd" id="4_ymvgp"]
[ext_resource type="ArrayMesh" uid="uid://dxeseuqcwne1m" path="res://assets/meshes/jar_fill.res" id="6_kfk5m"]
[ext_resource type="Script" uid="uid://co33kqhl3n06u" path="res://src/interactible/destructor.gd" id="7_00jpx"]
[ext_resource type="Script" uid="uid://c8epd7gguvyop" path="res://src/substance_holder.gd" id="7_ymvgp"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_pcpcb"]
resource_local_to_scene = true
[sub_resource type="CylinderShape3D" id="CylinderShape3D_kfk5m"]
height = 0.5024414
@ -25,6 +29,11 @@ script = ExtResource("1_o7vug")
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, -0.20877336, 0)
mesh = ExtResource("2_o7vug")
[node name="JarFill" type="MeshInstance3D" parent="."]
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, -0.20759426, 0)
material_override = SubResource("StandardMaterial3D_pcpcb")
mesh = ExtResource("6_kfk5m")
[node name="DragArea" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.04284668, 0)
shape = SubResource("CylinderShape3D_kfk5m")
@ -71,14 +80,13 @@ step = 0.01
allow_greater = true
suffix = "мг"
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, -0.20759426, 0)
mesh = ExtResource("6_kfk5m")
[node name="DestructorOnStop" type="Node" parent="." node_paths=PackedStringArray("node")]
script = ExtResource("7_00jpx")
node = NodePath("..")
[node name="SubstanceData" type="Node" parent="."]
script = ExtResource("7_ymvgp")
[connection signal="drag_ended" from="." to="InteractionArea" method="request_interaction"]
[connection signal="interaction_closed" from="InteractionArea" to="DestructorOnStop" method="destruct"]
[connection signal="interaction_reciever_entered" from="InteractionArea" to="ProximityRotator" method="_on_interaction_area_interaction_reciever_entered"]

11
src/substance_holder.gd Normal file
View file

@ -0,0 +1,11 @@
extends Node
var substance: Substance
func _ready() -> void:
if substance:
var jar_fill_material = $"../JarFill".material_override
jar_fill_material.albedo_color = substance.color
if substance.melting_point > 20:
jar_fill_material.albedo_texture = preload("res://assets/textures/solid.png")

View file

@ -0,0 +1 @@
uid://c8epd7gguvyop

View file

@ -11,6 +11,7 @@ func _on_button_down() -> void:
if scene is DraggableObject:
scene.dragged = true
scene.mouse_in = true
scene.get_node("SubstanceData").substance = reagent.substance
get_tree().current_scene.add_child(scene)
var camera = get_viewport().get_camera_3d()
scene.global_position = camera.project_position(get_global_mouse_position(),1.8)