Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the sniper-rifle and picatinny-scope colliders #696

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 26 additions & 17 deletions assets/3dmodelscc0/models/scenes/sniper_rifle.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=38 format=3 uid="uid://bmjemjgtnpkpo"]
[gd_scene load_steps=39 format=3 uid="uid://bmjemjgtnpkpo"]

[ext_resource type="PackedScene" uid="uid://c8l60rnugru40" path="res://addons/godot-xr-tools/objects/pickable.tscn" id="1_lpv7q"]
[ext_resource type="Script" path="res://assets/3dmodelscc0/models/scenes/sniper_rifle.gd" id="2_bdnea"]
Expand All @@ -23,8 +23,12 @@
[ext_resource type="Animation" uid="uid://ca21ej1p3g2yt" path="res://addons/godot-xr-tools/hands/animations/right/Pinch Tight.res" id="18_1meaq"]
[ext_resource type="PackedScene" uid="uid://cxytulli8pgww" path="res://scenes/pickable_demo/objects/picatinny_rail.tscn" id="20_e06no"]

[sub_resource type="BoxShape3D" id="BoxShape3D_apd71"]
size = Vector3(0.0449182, 0.184766, 1.145)
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_2hot7"]
points = PackedVector3Array(-0.014913, -0.072094, 0.106712, 0.014314, -0.072094, 0.106712, -0.014913, 0.0674413, 0.106712, -0.014913, 0.0867063, -0.682216, -0.0115915, 0.0503843, -0.682216, 0.014314, 0.0674413, 0.106712, 0.0115504, 0.0503843, -0.682216, 0.014314, 0.0867063, -0.682216, -0.014913, 0.086753, -0.246668, 0.014314, 0.086753, -0.246668)

[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_u56gf"]
radius = 0.008
height = 0.8

[sub_resource type="SphereShape3D" id="SphereShape3D_exh4i"]
radius = 0.06
Expand Down Expand Up @@ -112,17 +116,22 @@ radius = 0.001

[node name="SniperRifle" instance=ExtResource("1_lpv7q")]
collision_mask = 7
mass = 4.0
script = ExtResource("2_bdnea")
second_hand_grab = 2

[node name="CollisionShape3D" parent="." index="0"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00313599, -0.0495274, 0.0465783)
shape = SubResource("BoxShape3D_apd71")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00297323, -0.0689394, 0.511386)
shape = SubResource("ConvexPolygonShape3D_2hot7")

[node name="CollisionShape3D2" type="CollisionShape3D" parent="." index="1"]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0.0178034, -0.124555)
shape = SubResource("CapsuleShape3D_u56gf")

[node name="HighlightRing" parent="." index="1" instance=ExtResource("6_x8gva")]
[node name="HighlightRing" parent="." index="2" instance=ExtResource("6_x8gva")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0309925, 0.3)

[node name="sniper_rifle" parent="." index="2" instance=ExtResource("7_tk4wb")]
[node name="sniper_rifle" parent="." index="3" instance=ExtResource("7_tk4wb")]

[node name="Barrel" parent="sniper_rifle/SniperRifle" index="0"]
surface_material_override/0 = ExtResource("8_7v2rw")
Expand Down Expand Up @@ -203,47 +212,47 @@ target = NodePath("../../../SliderBody/Bolt/GrabPointHandleLeft")
[node name="GrabPointRedirectRight" parent="sniper_rifle/FirearmSlide/HandleOrigin/InteractableHandle" index="2" node_paths=PackedStringArray("target") instance=ExtResource("15_lnxyf")]
target = NodePath("../../../SliderBody/Bolt/GrabPointHandleRight")

[node name="XRFirearmTrigger" type="Node" parent="." index="3" node_paths=PackedStringArray("mesh_trigger", "handle_grabpoints")]
[node name="XRFirearmTrigger" type="Node" parent="." index="4" node_paths=PackedStringArray("mesh_trigger", "handle_grabpoints")]
script = ExtResource("9_0ljhu")
mesh_trigger = NodePath("../sniper_rifle/SniperRifle/Trigger")
value = 0.25
handle_grabpoints = [NodePath("../sniper_rifle/FirearmSlide/SliderBody/Bolt/GrabPointHandleLeft"), NodePath("../sniper_rifle/FirearmSlide/SliderBody/Bolt/GrabPointHandleRight")]

[node name="GrabPointGripLeft" parent="." index="4" instance=ExtResource("2_x4cgt")]
[node name="GrabPointGripLeft" parent="." index="5" instance=ExtResource("2_x4cgt")]
transform = Transform3D(1, 0, 0, 0, 0.975366, 0.220595, 0, -0.220595, 0.975366, 0.001, -0.016, 0.207)
handle = "Grip"
mode = 1
hand_pose = SubResource("Resource_ok7hp")

[node name="GrabPointGripRight" parent="." index="5" instance=ExtResource("5_sjb82")]
[node name="GrabPointGripRight" parent="." index="6" instance=ExtResource("5_sjb82")]
transform = Transform3D(1, 0, 0, 0, 0.975366, 0.220595, 0, -0.220595, 0.975366, -0.00131561, -0.0162657, 0.207056)
handle = "Grip"
mode = 1
hand_pose = SubResource("Resource_kscym")

[node name="GrabPointForestockLeft" parent="." index="6" instance=ExtResource("2_x4cgt")]
transform = Transform3D(-2.50718e-08, -0.573576, -0.819152, 0.965926, 0.212012, -0.148453, 0.258819, -0.79124, 0.554032, 0.0292044, 0.0294211, -0.107)
[node name="GrabPointForestockLeft" parent="." index="7" instance=ExtResource("2_x4cgt")]
transform = Transform3D(-2.50718e-08, -0.573576, -0.819152, 0.965926, 0.212012, -0.148453, 0.258819, -0.79124, 0.554032, 0.0292044, 0.0294211, -0.164892)
visible = true
hand_pose = SubResource("Resource_tbrsh")
drive_position = 0.0
drive_angle = 0.0
drive_aim = 1.0

[node name="GrabPointForestockRight" parent="." index="7" instance=ExtResource("5_sjb82")]
transform = Transform3D(-2.50718e-08, 0.573576, 0.819152, -0.965926, 0.212012, -0.148452, -0.258819, -0.79124, 0.554032, -0.039, 0.029, -0.107)
[node name="GrabPointForestockRight" parent="." index="8" instance=ExtResource("5_sjb82")]
transform = Transform3D(-2.50718e-08, 0.573576, 0.819152, -0.965926, 0.212012, -0.148452, -0.258819, -0.79124, 0.554032, -0.039, 0.029, -0.164892)
hand_pose = SubResource("Resource_6toxn")
drive_position = 0.0
drive_angle = 0.0
drive_aim = 1.0

[node name="PicatinnyRail" parent="." index="8" instance=ExtResource("20_e06no")]
[node name="PicatinnyRail" parent="." index="9" instance=ExtResource("20_e06no")]
transform = Transform3D(-1, 0, 8.74228e-08, 0, 1, 0, -8.74228e-08, 0, -1, -0.00377285, 0.0421098, 0.0647577)

[node name="MagSnapZone" parent="." index="9" groups=["sniper_slot"] instance=ExtResource("15_coy4c")]
[node name="MagSnapZone" parent="." index="10" groups=["sniper_slot"] instance=ExtResource("15_coy4c")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00341882, -0.0350358, 0.15841)
snap_require = "sinper_magazine"

[node name="HandPoseArea" parent="." index="10" node_paths=PackedStringArray("grabpoints") instance=ExtResource("16_4b70r")]
[node name="HandPoseArea" parent="." index="11" node_paths=PackedStringArray("grabpoints") instance=ExtResource("16_4b70r")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00371962, 0.0341488, 0.238741)
left_pose = SubResource("Resource_xtv8j")
right_pose = SubResource("Resource_4jbx5")
Expand Down
27 changes: 18 additions & 9 deletions scenes/pickable_demo/objects/picatinny_scope.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=11 format=3 uid="uid://deuxld12hxsq0"]
[gd_scene load_steps=12 format=3 uid="uid://deuxld12hxsq0"]

[ext_resource type="PackedScene" uid="uid://c8l60rnugru40" path="res://addons/godot-xr-tools/objects/pickable.tscn" id="1_1xi8m"]
[ext_resource type="Material" uid="uid://pcfey2xeiuoe" path="res://assets/3dmodelscc0/models/sniper_rifle/sniper_rifle.material" id="2_dg5g0"]
Expand All @@ -7,8 +7,12 @@
[ext_resource type="PackedScene" uid="uid://ctw7nbntd5pcj" path="res://addons/godot-xr-tools/objects/grab_points/grab_point_hand_right.tscn" id="5_rbyja"]
[ext_resource type="Script" path="res://addons/godot-xr-tools/objects/snap_path_guide.gd" id="6_70w77"]

[sub_resource type="BoxShape3D" id="BoxShape3D_f44k4"]
size = Vector3(0.0432129, 0.059082, 0.332031)
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_g483t"]
radius = 0.022
height = 0.330153

[sub_resource type="BoxShape3D" id="BoxShape3D_1ypuc"]
size = Vector3(0.0166626, 0.0332336, 0.114258)

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ybnhb"]

Expand Down Expand Up @@ -45,12 +49,17 @@ blend_shape_mode = 0
shadow_mesh = SubResource("ArrayMesh_mmp6s")

[node name="PicatinnyScope" groups=["Picatinny"] instance=ExtResource("1_1xi8m")]
mass = 0.5

[node name="CollisionShape3D" parent="." index="0"]
transform = Transform3D(-1, 0, 8.74228e-08, 0, 1, 0, -8.74228e-08, 0, -1, 0.0028, 0.0208471, -0.0617341)
shape = SubResource("BoxShape3D_f44k4")
transform = Transform3D(-1, 0, 8.74228e-08, 8.74228e-08, -4.37114e-08, 1, 3.82137e-15, 1, 4.37114e-08, 0.00312254, 0.027, -0.062)
shape = SubResource("CapsuleShape3D_g483t")

[node name="CollisionShape3D2" type="CollisionShape3D" parent="." index="1"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00283813, 0.0102081, -0.0571289)
shape = SubResource("BoxShape3D_1ypuc")

[node name="Scope" type="MeshInstance3D" parent="." index="1"]
[node name="Scope" type="MeshInstance3D" parent="." index="2"]
transform = Transform3D(-1, 0, 8.74228e-08, 0, 1, 0, -8.74228e-08, 0, -1, -0.0042, 0.0232924, -0.0607575)
mesh = SubResource("ArrayMesh_u5vpv")
skeleton = NodePath("")
Expand All @@ -62,12 +71,12 @@ radius = 0.015
offset = 0.326
fov = 5.0

[node name="GrabPointHandLeft" parent="." index="2" instance=ExtResource("4_7qvw6")]
[node name="GrabPointHandLeft" parent="." index="3" instance=ExtResource("4_7qvw6")]
transform = Transform3D(-0.707107, 1.18331e-07, 0.707107, -0.707107, -3.09086e-08, -0.707107, -6.18173e-08, -1, 1.05529e-07, -0.0672, 0.0778826, -0.0907575)

[node name="GrabPointHandRight" parent="." index="3" instance=ExtResource("5_rbyja")]
[node name="GrabPointHandRight" parent="." index="4" instance=ExtResource("5_rbyja")]
transform = Transform3D(-0.707107, 7.462e-08, -0.707107, 0.707107, -3.09086e-08, -0.707107, -7.46201e-08, -1, -3.09087e-08, 0.0728, 0.0778826, -0.0907575)

[node name="XRToolsSnapPathGuide" type="Marker3D" parent="." index="4"]
[node name="XRToolsSnapPathGuide" type="Marker3D" parent="." index="5"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.11429)
script = ExtResource("6_70w77")