Skip to content

Commit

Permalink
added toggle button demo to test scene
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoSpark314 committed Jan 4, 2020
1 parent 1ab01d8 commit 45b385a
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 13 deletions.
@@ -1,7 +1,8 @@
# Attach this script to any rigid body you want to be grabbable
# by the Feature_RigidBodyGrab
extends RigidBody

# makes a rigid body grabbable by OQ_Controller
class_name GrabbableRigidBody
class_name OQClass_GrabbableRigidBody


var target_node = null;
Expand Down
9 changes: 4 additions & 5 deletions OQ_Toolkit/OQ_Interactables/OQ_ButtonPressable.tscn
@@ -1,7 +1,6 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=4 format=2]

[ext_resource path="res://scripts/OQ_ButtonPressable.gd" type="Script" id=2]
[ext_resource path="res://materials/bright_metal.tres" type="Material" id=4]
[ext_resource path="res://OQ_Toolkit/OQ_Interactables/scripts/OQ_ButtonPressable.gd" type="Script" id=1]

[sub_resource type="CubeMesh" id=1]

Expand All @@ -11,12 +10,12 @@ extents = Vector3( 0.0290335, 0.0168922, 0.00678976 )

[node name="OQ_ButtonPressable" type="Spatial"]
transform = Transform( 1, 1.49012e-08, 0, 0, 1, -5.96046e-08, 0, 0, 1, 0, 0, 0 )
script = ExtResource( 2 )
script = ExtResource( 1 )

[node name="MeshInstance" type="MeshInstance" parent="."]
transform = Transform( 0.0283254, -1.16415e-09, -2.32831e-10, 1.86265e-09, 0.0159037, 3.95812e-09, 2.79397e-09, -1.00117e-08, 0.00740362, 0, 0, 0 )
mesh = SubResource( 1 )
material/0 = ExtResource( 4 )
material/0 = null

[node name="ButtonArea" type="Area" parent="."]

Expand Down
6 changes: 3 additions & 3 deletions OQ_Toolkit/OQ_Interactables/scripts/OQ_ButtonPressable.gd
@@ -1,7 +1,7 @@
extends Spatial
# This is a first draft of a pressable toggle button
# At the moment it interacts with any area that enters it

# a button that needs to be physically pressed
class_name ButtonPressable
extends Spatial

signal button_pressed

Expand Down
2 changes: 1 addition & 1 deletion OQ_Toolkit/OQ_UI2D/scripts/OQ_UI2DVRSettings.gd
Expand Up @@ -44,7 +44,7 @@ func _ready():

func _process(delta):
if (is_visible_in_tree() && vr.ovrUtilities):
ipd_info_label.set_label_text("Current IPD: %.1fmm" % (vr.get_ipd() * 1000.0));
ipd_info_label.set_text("Current IPD: %.1fmm" % (vr.get_ipd() * 1000.0));


func _on_FoveationLevel_OptionButton_item_selected(id):
Expand Down
4 changes: 3 additions & 1 deletion demo_scenes/PhysicsScene.tscn
Expand Up @@ -10,7 +10,9 @@
[ext_resource path="res://OQ_Toolkit/OQ_ARVRCamera.tscn" type="PackedScene" id=8]
[ext_resource path="res://OQ_Toolkit/OQ_ARVRController/Feature_ControllerModel_Left.tscn" type="PackedScene" id=9]
[ext_resource path="res://demo_scenes/data/models_3d/GrabAndThrowRoom/GrabAndThrowRoom.gltf" type="PackedScene" id=10]
[ext_resource path="res://OQ_Toolkit/OQ_ARVRController/scripts/grabbable_rigid_body.gd" type="Script" id=11]
[ext_resource path="res://OQ_Toolkit/OQ_Classes/OQClass_GrabbableRigidBody.gd" type="Script" id=11]



[sub_resource type="BoxShape" id=1]
extents = Vector3( 0.1, 0.1, 0.1 )
Expand Down
16 changes: 15 additions & 1 deletion demo_scenes/UIDemoScene.tscn
@@ -1,4 +1,4 @@
[gd_scene load_steps=23 format=2]
[gd_scene load_steps=27 format=2]

[ext_resource path="res://OQ_Toolkit/OQ_ARVRCamera.tscn" type="PackedScene" id=1]
[ext_resource path="res://OQ_Toolkit/OQ_ARVROrigin/Feature_VRSimulator.tscn" type="PackedScene" id=2]
Expand All @@ -18,6 +18,10 @@
[ext_resource path="res://icon.png" type="Texture" id=16]
[ext_resource path="res://OQ_Toolkit/OQ_UI2D/OQ_UI2DLogWindow.tscn" type="PackedScene" id=17]
[ext_resource path="res://OQ_Toolkit/OQ_UI2D/OQ_UI2DLabel_IPD.tscn" type="PackedScene" id=18]
[ext_resource path="res://OQ_Toolkit/OQ_Interactables/OQ_ButtonPressable.tscn" type="PackedScene" id=19]
[ext_resource path="res://OQ_Toolkit/OQ_ARVRController/Feature_StaticGrab.tscn" type="PackedScene" id=20]
[ext_resource path="res://demo_scenes/data/Material_Green.material" type="Material" id=21]
[ext_resource path="res://demo_scenes/data/Material_Red.material" type="Material" id=22]

[sub_resource type="PlaneMesh" id=1]
size = Vector2( 16, 16 )
Expand Down Expand Up @@ -170,13 +174,17 @@ __meta__ = {
"_edit_use_anchors_": false
}

[node name="Feature_StaticGrab" parent="OQ_ARVROrigin/OQ_LeftController" instance=ExtResource( 20 )]

[node name="OQ_RightController" parent="OQ_ARVROrigin" instance=ExtResource( 13 )]

[node name="Feature_ControllerModel_Right" parent="OQ_ARVROrigin/OQ_RightController" instance=ExtResource( 8 )]

[node name="Feature_UIRayCast" parent="OQ_ARVROrigin/OQ_RightController" instance=ExtResource( 12 )]
ui_raycast_visible_button = -1

[node name="Feature_StaticGrab" parent="OQ_ARVROrigin/OQ_RightController" instance=ExtResource( 20 )]

[node name="Locomotion_Stick" parent="OQ_ARVROrigin" instance=ExtResource( 11 )]
enable_vignette = false

Expand Down Expand Up @@ -474,6 +482,12 @@ transform = Transform( 0.999394, 0, 0.8662, 0, 2, 0, -1.7324, 0, 0.499697, -1.57

[node name="OQ_UI2DVRSettings" parent="." instance=ExtResource( 15 )]
transform = Transform( 2.95446, 0, -0.173579, 0, 3, 0, 0.520738, 0, 0.98482, 0.732496, 1.73966, -1.24014 )

[node name="OQ_ButtonPressable" parent="." instance=ExtResource( 19 )]
transform = Transform( 1, 1.49012e-08, 0, 0, 1, -5.96046e-08, 0, 0, 1, -0.0901041, 1.35395, -0.834221 )
press_distance = 0.02
off_material = ExtResource( 22 )
on_material = ExtResource( 21 )
[connection signal="value_changed" from="OQ_UI2DCanvas_MovementOptions/Control/MoveSpeedSpinBox" to="." method="_on_MoveSpeedSpinBox_value_changed"]
[connection signal="value_changed" from="OQ_UI2DCanvas_MovementOptions/Control/RotateSpeedSpinBox" to="." method="_on_RotateSpeedSpinBox_value_changed"]
[connection signal="value_changed" from="OQ_UI2DCanvas_MovementOptions/Control/ClickTurnAngleSpinBox" to="." method="_on_ClickTurnAngleSpinBox_value_changed"]
Expand Down
10 changes: 10 additions & 0 deletions project.godot
Expand Up @@ -8,6 +8,16 @@

config_version=4

_global_script_classes=[ {
"base": "RigidBody",
"class": "OQClass_GrabbableRigidBody",
"language": "GDScript",
"path": "res://OQ_Toolkit/OQ_Classes/OQClass_GrabbableRigidBody.gd"
} ]
_global_script_class_icons={
"OQClass_GrabbableRigidBody": ""
}

[application]

config/name="Godot Oculus Quest Toolkit Demo"
Expand Down

0 comments on commit 45b385a

Please sign in to comment.