lever model

This commit is contained in:
SlightlyObscure 2019-11-22 11:11:10 +01:00
parent 0d7fc95ed1
commit 0c8b8e208a
3 changed files with 82 additions and 5 deletions

View File

@ -1,10 +1,11 @@
[gd_scene load_steps=15 format=2] [gd_scene load_steps=16 format=2]
[ext_resource path="res://Level/Machinations/PipeGame.gd" type="Script" id=1] [ext_resource path="res://Level/Machinations/PipeGame.gd" type="Script" id=1]
[ext_resource path="res://Things/Pipes/EckiPipe.tscn" type="PackedScene" id=2] [ext_resource path="res://Things/Pipes/EckiPipe.tscn" type="PackedScene" id=2]
[ext_resource path="res://Things/ReusableMaterials/Pipe_Dream.tres" type="Material" id=3] [ext_resource path="res://Things/ReusableMaterials/Pipe_Dream.tres" type="Material" id=3]
[ext_resource path="res://Things/Pipes/StraightPipe.tscn" type="PackedScene" id=4] [ext_resource path="res://Things/Pipes/StraightPipe.tscn" type="PackedScene" id=4]
[ext_resource path="res://Things/Pipes/StraightForkPipe.tscn" type="PackedScene" id=5] [ext_resource path="res://Things/Pipes/StraightForkPipe.tscn" type="PackedScene" id=5]
[ext_resource path="res://Things/Lever/Lever.tscn" type="PackedScene" id=6]
[sub_resource type="BoxShape" id=1] [sub_resource type="BoxShape" id=1]
@ -44,11 +45,11 @@ fork7 = NodePath("Pipes/Forks/Fork8")
fork8 = NodePath("Pipes/Forks/Fork9") fork8 = NodePath("Pipes/Forks/Fork9")
[node name="CollisionShape" type="CollisionShape" parent="."] [node name="CollisionShape" type="CollisionShape" parent="."]
transform = Transform( 2, 0, 0, 0, 0.2, 0, 0, 0, 1, 0, 0.85, 0 ) transform = Transform( 2.3, 0, 0, 0, 0.2, 0, 0, 0, 1, 0.3, 0.85, 0 )
shape = SubResource( 1 ) shape = SubResource( 1 )
[node name="Table" type="MeshInstance" parent="."] [node name="Table" type="MeshInstance" parent="."]
transform = Transform( 2, 0, 0, 0, 0.2, 0, 0, 0, 1, 0, 0.85, 0 ) transform = Transform( 2.3, 0, 0, 0, 0.2, 0, 0, 0, 1, 0.3, 0.85, 0 )
layers = 3 layers = 3
mesh = SubResource( 2 ) mesh = SubResource( 2 )
material/0 = null material/0 = null
@ -105,6 +106,7 @@ mesh = SubResource( 3 )
material/0 = SubResource( 9 ) material/0 = SubResource( 9 )
[node name="Pipes" type="Spatial" parent="."] [node name="Pipes" type="Spatial" parent="."]
editor/display_folded = true
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0 )
[node name="Forks" type="Spatial" parent="Pipes"] [node name="Forks" type="Spatial" parent="Pipes"]
@ -446,8 +448,8 @@ outline_path = NodePath("../../../PipeGame/Pipes/Pipe33/Mesh/Outline")
transform = Transform( -1, 8.74228e-008, 0, -8.74228e-008, -1, 0, 0, 0, 1, -1.95, 1.65, 0.4 ) transform = Transform( -1, 8.74228e-008, 0, -8.74228e-008, -1, 0, 0, 0, 1, -1.95, 1.65, 0.4 )
outline_path = NodePath("../../../PipeGame/Pipes/Pipe62/Mesh/Outline") outline_path = NodePath("../../../PipeGame/Pipes/Pipe62/Mesh/Outline")
[node name="Camera" type="Camera" parent="."] [node name="Lever" parent="." instance=ExtResource( 6 )]
transform = Transform( 1, 0, 0, 0, 0.764615, 0.644487, 0, -0.644487, 0.764615, 0, 4.83485, 5.44687 ) transform = Transform( 1, 0, 0, 0, -4.37114e-008, 1, 0, -1, -4.37114e-008, 2.4, 1.1, 0 )
[editable path="Pipes/Forks/Fork1"] [editable path="Pipes/Forks/Fork1"]

25
Things/Lever/Lever.gd Normal file
View File

@ -0,0 +1,25 @@
extends StaticBody
# export variables
export(NodePath) var outline_path
export(NodePath) var levermesh_path
# private members
var _isOn = false
# var b = "text"
func do_interact(var player):
if(_isOn):
get_node(levermesh_path).rotate_x(-PI/2)
_isOn = false
else:
get_node(levermesh_path).rotate_x(PI/2)
_isOn = true
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

50
Things/Lever/Lever.tscn Normal file
View File

@ -0,0 +1,50 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://Things/Lever/Lever.gd" type="Script" id=1]
[ext_resource path="res://Things/ReusableMaterials/Glow.tres" type="Material" id=2]
[sub_resource type="CubeMesh" id=1]
[sub_resource type="CubeMesh" id=2]
[sub_resource type="ArrayMesh" id=3]
surfaces/0 = {
"aabb": AABB( -1.11547, -1.11547, -1.11547, 2.23094, 2.23095, 2.23095 ),
"array_data": PoolByteArray( 185, 199, 142, 191, 185, 199, 142, 63, 185, 199, 142, 63, 0, 0, 127, 0, 127, 0, 0, 127, 0, 0, 0, 0, 185, 199, 142, 63, 185, 199, 142, 63, 185, 199, 142, 191, 0, 0, 129, 0, 129, 0, 0, 127, 85, 57, 0, 0, 185, 199, 142, 63, 185, 199, 142, 63, 185, 199, 142, 63, 0, 0, 127, 0, 127, 0, 0, 127, 85, 53, 0, 0, 185, 199, 142, 191, 185, 199, 142, 63, 185, 199, 142, 191, 0, 0, 129, 0, 129, 0, 0, 127, 0, 60, 0, 0, 185, 199, 142, 191, 185, 199, 142, 191, 185, 199, 142, 63, 0, 0, 127, 0, 127, 0, 0, 127, 0, 0, 0, 56, 185, 199, 142, 63, 185, 199, 142, 191, 185, 199, 142, 191, 0, 0, 129, 0, 129, 0, 0, 127, 85, 57, 0, 56, 185, 199, 142, 63, 185, 199, 142, 191, 185, 199, 142, 63, 0, 0, 127, 0, 127, 0, 0, 127, 85, 53, 0, 56, 185, 199, 142, 191, 185, 199, 142, 191, 185, 199, 142, 191, 0, 0, 129, 0, 129, 0, 0, 127, 0, 60, 0, 56, 185, 199, 142, 63, 185, 199, 142, 63, 185, 199, 142, 63, 127, 0, 0, 0, 0, 0, 129, 127, 85, 53, 0, 0, 185, 199, 142, 191, 185, 199, 142, 63, 185, 199, 142, 191, 129, 0, 0, 0, 0, 0, 127, 127, 0, 0, 0, 56, 185, 199, 142, 63, 185, 199, 142, 63, 185, 199, 142, 191, 127, 0, 0, 0, 0, 0, 129, 127, 85, 57, 0, 0, 185, 199, 142, 191, 185, 199, 142, 63, 185, 199, 142, 63, 129, 0, 0, 0, 0, 0, 127, 127, 85, 53, 0, 56, 185, 199, 142, 63, 185, 199, 142, 191, 185, 199, 142, 63, 127, 0, 0, 0, 0, 0, 129, 127, 85, 53, 0, 56, 185, 199, 142, 191, 185, 199, 142, 191, 185, 199, 142, 191, 129, 0, 0, 0, 0, 0, 127, 127, 0, 0, 0, 60, 185, 199, 142, 63, 185, 199, 142, 191, 185, 199, 142, 191, 127, 0, 0, 0, 0, 0, 129, 127, 85, 57, 0, 56, 185, 199, 142, 191, 185, 199, 142, 191, 185, 199, 142, 63, 129, 0, 0, 0, 0, 0, 127, 127, 85, 53, 0, 60, 185, 199, 142, 63, 185, 199, 142, 63, 185, 199, 142, 63, 0, 127, 0, 0, 129, 0, 0, 127, 85, 53, 0, 56, 185, 199, 142, 191, 185, 199, 142, 191, 185, 199, 142, 63, 0, 129, 0, 0, 127, 0, 0, 127, 85, 57, 0, 56, 185, 199, 142, 191, 185, 199, 142, 63, 185, 199, 142, 63, 0, 127, 0, 0, 129, 0, 0, 127, 85, 57, 0, 56, 185, 199, 142, 63, 185, 199, 142, 191, 185, 199, 142, 63, 0, 129, 0, 0, 127, 0, 0, 127, 0, 60, 0, 56, 185, 199, 142, 63, 185, 199, 142, 63, 185, 199, 142, 191, 0, 127, 0, 0, 129, 0, 0, 127, 85, 53, 0, 60, 185, 199, 142, 191, 185, 199, 142, 191, 185, 199, 142, 191, 0, 129, 0, 0, 127, 0, 0, 127, 85, 57, 0, 60, 185, 199, 142, 191, 185, 199, 142, 63, 185, 199, 142, 191, 0, 127, 0, 0, 129, 0, 0, 127, 85, 57, 0, 60, 185, 199, 142, 63, 185, 199, 142, 191, 185, 199, 142, 191, 0, 129, 0, 0, 127, 0, 0, 127, 0, 60, 0, 60 ),
"array_index_data": PoolByteArray( 0, 0, 4, 0, 2, 0, 2, 0, 4, 0, 6, 0, 1, 0, 5, 0, 3, 0, 3, 0, 5, 0, 7, 0, 8, 0, 12, 0, 10, 0, 10, 0, 12, 0, 14, 0, 9, 0, 13, 0, 11, 0, 11, 0, 13, 0, 15, 0, 16, 0, 20, 0, 18, 0, 18, 0, 20, 0, 22, 0, 17, 0, 21, 0, 19, 0, 19, 0, 21, 0, 23, 0 ),
"blend_shape_data": [ ],
"format": 97559,
"index_count": 36,
"primitive": 4,
"skeleton_aabb": [ ],
"vertex_count": 24
}
[sub_resource type="BoxShape" id=4]
[node name="Lever" type="StaticBody" groups=[
"Touchables",
]]
script = ExtResource( 1 )
outline_path = NodePath("LeverMesh/Outline")
levermesh_path = NodePath("LeverMesh")
[node name="BoxMesh" type="MeshInstance" parent="."]
transform = Transform( 0.1, 0, 0, 0, 0.2, 0, 0, 0, 0.05, 0, 0, 0 )
mesh = SubResource( 1 )
material/0 = null
[node name="LeverMesh" type="MeshInstance" parent="."]
transform = Transform( 0.025, 0, 0, 0, 0.141421, -0.0176777, 0, 0.141421, 0.0176777, 0, 0.15, 0.17 )
mesh = SubResource( 2 )
material/0 = null
[node name="Outline" type="MeshInstance" parent="LeverMesh"]
transform = Transform( 1.05, 0, 0, 0, 0.95, 0, 0, 0, 1.05, 0, 0, 0 )
visible = false
mesh = SubResource( 3 )
material/0 = ExtResource( 2 )
[node name="CollisionShape" type="CollisionShape" parent="."]
transform = Transform( 0.1, 0, 0, 0, 0.25, 0, 0, 0, 0.2, 0, 0.05, 0.15 )
shape = SubResource( 4 )