gif
This commit is contained in:
parent
bcf363d798
commit
ffeaf1aaa8
|
@ -11,6 +11,7 @@ config_version=5
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="nordic25"
|
config/name="nordic25"
|
||||||
|
run/main_scene="uid://din25343yu8wv"
|
||||||
config/features=PackedStringArray("4.4", "C#", "Forward Plus")
|
config/features=PackedStringArray("4.4", "C#", "Forward Plus")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[gd_scene load_steps=8 format=3 uid="uid://8fmy7u5fyonc"]
|
[gd_scene load_steps=8 format=3 uid="uid://8fmy7u5fyonc"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://bf27rxigs8b22" path="res://scripts/XRHand.cs" id="1_gyc3h"]
|
[ext_resource type="Script" uid="uid://bf27rxigs8b22" path="res://scripts/XRHand.cs" id="1_gyc3h"]
|
||||||
[ext_resource type="Script" uid="uid://dglj0x0bpkx5i" path="res://scripts/XrOrigin3d.cs" id="1_ucfva"]
|
[ext_resource type="Script" uid="uid://cjuwcdex32ad0" path="res://scripts/GrabTester.cs" id="3_graai"]
|
||||||
[ext_resource type="Script" uid="uid://typrll7n6g3e" path="res://scripts/Mouth.cs" id="3_un1ji"]
|
[ext_resource type="Script" uid="uid://typrll7n6g3e" path="res://scripts/Mouth.cs" id="3_un1ji"]
|
||||||
|
|
||||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_ij1v8"]
|
[sub_resource type="CapsuleMesh" id="CapsuleMesh_ij1v8"]
|
||||||
|
@ -19,13 +19,12 @@ radius = 0.03
|
||||||
|
|
||||||
[node name="XROrigin3D" type="XROrigin3D"]
|
[node name="XROrigin3D" type="XROrigin3D"]
|
||||||
current = true
|
current = true
|
||||||
script = ExtResource("1_ucfva")
|
|
||||||
|
|
||||||
[node name="LeftHand" type="XRController3D" parent="." node_paths=PackedStringArray("body")]
|
[node name="LeftHand" type="XRController3D" parent="." node_paths=PackedStringArray("rb")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.381652, 0.302346, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.381652, 0.302346, 0)
|
||||||
tracker = &"left_hand"
|
tracker = &"left_hand"
|
||||||
script = ExtResource("1_gyc3h")
|
script = ExtResource("1_gyc3h")
|
||||||
body = NodePath("RigidBody3D")
|
rb = NodePath("RigidBody3D")
|
||||||
|
|
||||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="LeftHand"]
|
[node name="MeshInstance3D" type="MeshInstance3D" parent="LeftHand"]
|
||||||
mesh = SubResource("CapsuleMesh_ij1v8")
|
mesh = SubResource("CapsuleMesh_ij1v8")
|
||||||
|
@ -43,11 +42,9 @@ disabled = true
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="LeftHand/Area3D"]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="LeftHand/Area3D"]
|
||||||
shape = SubResource("SphereShape3D_un1ji")
|
shape = SubResource("SphereShape3D_un1ji")
|
||||||
|
|
||||||
[node name="RightHand" type="XRController3D" parent="." node_paths=PackedStringArray("body")]
|
[node name="RightHand" type="XRController3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.412168, 0.292391, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.412168, 0.292391, 0)
|
||||||
tracker = &"right_hand"
|
tracker = &"right_hand"
|
||||||
script = ExtResource("1_gyc3h")
|
|
||||||
body = NodePath("RigidBody3D")
|
|
||||||
|
|
||||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="RightHand"]
|
[node name="MeshInstance3D" type="MeshInstance3D" parent="RightHand"]
|
||||||
mesh = SubResource("CapsuleMesh_ij1v8")
|
mesh = SubResource("CapsuleMesh_ij1v8")
|
||||||
|
@ -55,6 +52,7 @@ mesh = SubResource("CapsuleMesh_ij1v8")
|
||||||
[node name="RigidBody3D" type="RigidBody3D" parent="RightHand"]
|
[node name="RigidBody3D" type="RigidBody3D" parent="RightHand"]
|
||||||
freeze = true
|
freeze = true
|
||||||
freeze_mode = 1
|
freeze_mode = 1
|
||||||
|
script = ExtResource("3_graai")
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="RightHand/RigidBody3D"]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="RightHand/RigidBody3D"]
|
||||||
shape = SubResource("SphereShape3D_iyx0m")
|
shape = SubResource("SphereShape3D_iyx0m")
|
||||||
|
@ -66,7 +64,7 @@ disabled = true
|
||||||
shape = SubResource("SphereShape3D_un1ji")
|
shape = SubResource("SphereShape3D_un1ji")
|
||||||
|
|
||||||
[node name="XRCamera3D" type="XRCamera3D" parent="." node_paths=PackedStringArray("RightHand", "LeftHand")]
|
[node name="XRCamera3D" type="XRCamera3D" parent="." node_paths=PackedStringArray("RightHand", "LeftHand")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.821388, 0.40056)
|
transform = Transform3D(0.447029, 0.69956, -0.557478, -0.351336, 0.710443, 0.609782, 0.822635, -0.0767277, 0.563369, 0, 0.821388, 0.40056)
|
||||||
near = 0.005
|
near = 0.005
|
||||||
script = ExtResource("3_un1ji")
|
script = ExtResource("3_un1ji")
|
||||||
RightHand = NodePath("../RightHand")
|
RightHand = NodePath("../RightHand")
|
||||||
|
@ -86,5 +84,6 @@ shape = SubResource("SphereShape3D_ucfva")
|
||||||
[connection signal="button_pressed" from="RightHand" to="RightHand" method="OnPress"]
|
[connection signal="button_pressed" from="RightHand" to="RightHand" method="OnPress"]
|
||||||
[connection signal="button_released" from="RightHand" to="RightHand" method="OnRelease"]
|
[connection signal="button_released" from="RightHand" to="RightHand" method="OnRelease"]
|
||||||
[connection signal="input_float_changed" from="RightHand" to="RightHand" method="OnFloat"]
|
[connection signal="input_float_changed" from="RightHand" to="RightHand" method="OnFloat"]
|
||||||
|
[connection signal="SpamGrab" from="RightHand/RigidBody3D" to="RightHand" method="OnPress"]
|
||||||
[connection signal="body_entered" from="RightHand/Area3D" to="RightHand" method="OnEnter"]
|
[connection signal="body_entered" from="RightHand/Area3D" to="RightHand" method="OnEnter"]
|
||||||
[connection signal="body_exited" from="RightHand/Area3D" to="RightHand" method="OnLeave"]
|
[connection signal="body_exited" from="RightHand/Area3D" to="RightHand" method="OnLeave"]
|
||||||
|
|
|
@ -33,7 +33,9 @@ skeleton = NodePath("")
|
||||||
shape = SubResource("WorldBoundaryShape3D_lpvoh")
|
shape = SubResource("WorldBoundaryShape3D_lpvoh")
|
||||||
|
|
||||||
[node name="Bananan" type="RigidBody3D" parent="."]
|
[node name="Bananan" type="RigidBody3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0676612, 0.46696, -0.00682727)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.3997, 0.647031, -0.00682727)
|
||||||
|
gravity_scale = 0.01
|
||||||
|
can_sleep = false
|
||||||
|
|
||||||
[node name="banana" parent="Bananan" instance=ExtResource("2_bl13t")]
|
[node name="banana" parent="Bananan" instance=ExtResource("2_bl13t")]
|
||||||
transform = Transform3D(0.02, 0, 0, 0, 0.02, 0, 0, 0, 0.02, 0, 0, 0)
|
transform = Transform3D(0.02, 0, 0, 0, 0.02, 0, 0, 0, 0.02, 0, 0, 0)
|
||||||
|
|
12
scripts/GrabTester.cs
Normal file
12
scripts/GrabTester.cs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
public partial class GrabTester : RigidBody3D {
|
||||||
|
|
||||||
|
[Signal]
|
||||||
|
public delegate void SpamGrabEventHandler(string name);
|
||||||
|
|
||||||
|
|
||||||
|
public override void _Process(double delta) {
|
||||||
|
EmitSignal(SignalName.SpamGrab, "select_button");
|
||||||
|
}
|
||||||
|
}
|
1
scripts/GrabTester.cs.uid
Normal file
1
scripts/GrabTester.cs.uid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uid://cjuwcdex32ad0
|
|
@ -3,16 +3,21 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
public partial class XRHand : XRController3D
|
public partial class XRHand : XRController3D
|
||||||
{
|
{
|
||||||
List<PinJoint3D> joints = new();
|
List<Generic6DofJoint3D> joints = new();
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
RigidBody3D body;
|
RigidBody3D rb;
|
||||||
|
|
||||||
List<RigidBody3D> overlaps;
|
List<RigidBody3D> overlaps = new();
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
public float Strength = 1.0f;
|
public float Strength = 1.0f;
|
||||||
|
|
||||||
|
public override void _Ready() {
|
||||||
|
if (rb == null)
|
||||||
|
GD.PrintErr("Missing Rigidbody");
|
||||||
|
}
|
||||||
|
|
||||||
public void OnEnter(Node3D node)
|
public void OnEnter(Node3D node)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -44,26 +49,19 @@ public partial class XRHand : XRController3D
|
||||||
|
|
||||||
GD.Print("Picked up ", body);
|
GD.Print("Picked up ", body);
|
||||||
|
|
||||||
PinJoint3D joint = new();
|
Generic6DofJoint3D joint = new();
|
||||||
joint.NodeA = body.GetPath();
|
joint.NodeA = body.GetPath();
|
||||||
joint.NodeB = this.body.GetPath();
|
joint.NodeB = rb.GetPath();
|
||||||
joint.SetParam(PinJoint3D.Param.Bias, 10f);
|
|
||||||
joints.Add(joint);
|
joints.Add(joint);
|
||||||
|
rb.AddChild(joint);
|
||||||
PinJoint3D joint2 = new();
|
joint.Position = Vector3.Zero;
|
||||||
joint2.NodeA = this.body.GetPath();
|
|
||||||
joint2.NodeB = body.GetPath();
|
|
||||||
joint2.SetParam(PinJoint3D.Param.Bias, 10f);
|
|
||||||
joints.Add(joint2);
|
|
||||||
|
|
||||||
this.body.AddChild(joint);
|
|
||||||
body.AddChild(joint2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnRelease(string name)
|
public void OnRelease(string name)
|
||||||
{
|
{
|
||||||
|
GD.Print("lego");
|
||||||
if (name == "select_button")
|
if (name == "select_button")
|
||||||
{
|
{
|
||||||
foreach (var joint in joints)
|
foreach (var joint in joints)
|
||||||
|
|
Loading…
Reference in a new issue