Added lever

rose_physics
jonathan 3 months ago
parent 6a5494a3de
commit e8559b7993

@ -0,0 +1,14 @@
extends Node3D
@export var isUp:bool = true
@export var upPosition:float = 45
@export var downPosition:float = -45
@onready var visual_lever: Node3D = $Visuals/VisualLever
signal changed(isUp: bool)
func _on_interactable_on_hit() -> void:
isUp = !isUp
changed.emit(isUp)
visual_lever.rotation_degrees.x = upPosition if isUp else downPosition

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

@ -0,0 +1,40 @@
[gd_scene load_steps=6 format=3 uid="uid://cv3qpo5lfrchn"]
[ext_resource type="Script" uid="uid://de5n8vxvigaic" path="res://prefabs/lever.gd" id="1_7d20a"]
[ext_resource type="PackedScene" uid="uid://be7u1kn41g2ww" path="res://addons/interaction/interactable.tscn" id="1_h71ec"]
[sub_resource type="BoxShape3D" id="BoxShape3D_h71ec"]
size = Vector3(1, 1, 0.2)
[sub_resource type="BoxMesh" id="BoxMesh_ib36p"]
size = Vector3(0.405, 0.61, 0.09)
[sub_resource type="BoxMesh" id="BoxMesh_haun4"]
size = Vector3(0.1, 0.1, 0.5)
[node name="Lever" type="Node3D"]
script = ExtResource("1_7d20a")
upPosition = -45.0
downPosition = 45.0
[node name="Interactable" parent="." instance=ExtResource("1_h71ec")]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Interactable"]
shape = SubResource("BoxShape3D_h71ec")
[node name="Visuals" type="Node3D" parent="."]
[node name="VisualBase" type="Node3D" parent="Visuals"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="Visuals/VisualBase"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.029395461)
mesh = SubResource("BoxMesh_ib36p")
[node name="VisualLever" type="Node3D" parent="Visuals"]
transform = Transform3D(1, 0, 0, 0, 0.70710677, 0.70710677, 0, -0.70710677, 0.70710677, 0, 0, 0.04011269)
[node name="MeshInstance3D" type="MeshInstance3D" parent="Visuals/VisualLever"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.00422913, 0.22320583)
mesh = SubResource("BoxMesh_haun4")
[connection signal="on_hit" from="Interactable" to="." method="_on_interactable_on_hit"]

@ -1,9 +1,10 @@
[gd_scene load_steps=7 format=3 uid="uid://gq33ysuit61b"] [gd_scene load_steps=8 format=3 uid="uid://gq33ysuit61b"]
[ext_resource type="PackedScene" uid="uid://c70o7nk6wxcmx" path="res://models/UndertakerBlockout.fbx" id="2_gfayn"] [ext_resource type="PackedScene" uid="uid://c70o7nk6wxcmx" path="res://models/UndertakerBlockout.fbx" id="2_gfayn"]
[ext_resource type="PackedScene" uid="uid://be7u1kn41g2ww" path="res://addons/interaction/interactable.tscn" id="3_u0nvw"] [ext_resource type="PackedScene" uid="uid://be7u1kn41g2ww" path="res://addons/interaction/interactable.tscn" id="3_u0nvw"]
[ext_resource type="PackedScene" uid="uid://bxuveo0hlwy33" path="res://prefabs/character.tscn" id="4_tedjo"] [ext_resource type="PackedScene" uid="uid://bxuveo0hlwy33" path="res://prefabs/character.tscn" id="4_tedjo"]
[ext_resource type="Script" uid="uid://b1pyctfbd0wvg" path="res://scenes/debug_printer.gd" id="4_ui586"] [ext_resource type="Script" uid="uid://b1pyctfbd0wvg" path="res://scenes/debug_printer.gd" id="4_ui586"]
[ext_resource type="PackedScene" uid="uid://cv3qpo5lfrchn" path="res://prefabs/lever.tscn" id="5_tedjo"]
[sub_resource type="BoxShape3D" id="BoxShape3D_gfayn"] [sub_resource type="BoxShape3D" id="BoxShape3D_gfayn"]
size = Vector3(12.2438965, 0.48779297, 13.901489) size = Vector3(12.2438965, 0.48779297, 13.901489)
@ -38,4 +39,7 @@ script = ExtResource("4_ui586")
[node name="Character" parent="." instance=ExtResource("4_tedjo")] [node name="Character" parent="." instance=ExtResource("4_tedjo")]
[node name="Lever" parent="." instance=ExtResource("5_tedjo")]
transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, 1.884376, 1.4100053, 4.976951)
[connection signal="on_hit" from="Interactable" to="DebugPrinter" method="_on_interactable_on_hit"] [connection signal="on_hit" from="Interactable" to="DebugPrinter" method="_on_interactable_on_hit"]

Loading…
Cancel
Save