profile debugging
This commit is contained in:
parent
05308d88f1
commit
f27ff5d993
|
@ -3,54 +3,60 @@ using System.Collections.Generic;
|
|||
|
||||
public partial class XRHand : XRController3D
|
||||
{
|
||||
List<Generic6DofJoint3D> joints = new();
|
||||
List<Generic6DofJoint3D> joints = new();
|
||||
|
||||
[Export]
|
||||
StaticBody3D body;
|
||||
[Export]
|
||||
StaticBody3D body;
|
||||
|
||||
[Export]
|
||||
float strength = 1.0f;
|
||||
[Export]
|
||||
float strength = 1.0f;
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if ((bool)GetInput("trigger_click"))
|
||||
{
|
||||
var query = new PhysicsShapeQueryParameters3D();
|
||||
var sphere = new SphereShape3D();
|
||||
sphere.Radius = 0.1f;
|
||||
query.Shape = sphere;
|
||||
query.CollideWithBodies = true;
|
||||
query.CollideWithAreas = false;
|
||||
query.Transform = ((Node3D)GetParent()).GlobalTransform;
|
||||
var overlaps = GetWorld3D().DirectSpaceState.IntersectShape(query);
|
||||
foreach (var fuckingcollider in overlaps)
|
||||
{
|
||||
RigidBody3D body = null;
|
||||
try
|
||||
{
|
||||
body = (RigidBody3D)fuckingcollider["collider"];
|
||||
}
|
||||
catch (System.InvalidCastException)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if ((bool)GetInput("trigger_click"))
|
||||
{
|
||||
var query = new PhysicsShapeQueryParameters3D();
|
||||
var sphere = new SphereShape3D();
|
||||
sphere.Radius = 0.1f;
|
||||
query.Shape = sphere;
|
||||
query.CollideWithBodies = true;
|
||||
query.CollideWithAreas = false;
|
||||
query.Transform = ((Node3D)GetParent()).GlobalTransform;
|
||||
var overlaps = GetWorld3D().DirectSpaceState.IntersectShape(query);
|
||||
foreach (var fuckingcollider in overlaps)
|
||||
{
|
||||
RigidBody3D body = null;
|
||||
try
|
||||
{
|
||||
body = (RigidBody3D)fuckingcollider["collider"];
|
||||
}
|
||||
catch (System.InvalidCastException)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (body.Mass > strength) {
|
||||
continue;
|
||||
}
|
||||
if (body.Mass > strength)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Generic6DofJoint3D joint = new();
|
||||
joint.NodeA = GetPathTo(body);
|
||||
joint.NodeB = body.GetPath();
|
||||
joints.Add(joint);
|
||||
AddChild(joint);
|
||||
}
|
||||
}
|
||||
else if (joints.Count > 0)
|
||||
{
|
||||
foreach (var joint in joints)
|
||||
joint.QueueFree();
|
||||
joints.Clear();
|
||||
}
|
||||
}
|
||||
Generic6DofJoint3D joint = new();
|
||||
joint.NodeA = GetPathTo(body);
|
||||
joint.NodeB = body.GetPath();
|
||||
joints.Add(joint);
|
||||
AddChild(joint);
|
||||
}
|
||||
}
|
||||
else if (joints.Count > 0)
|
||||
{
|
||||
foreach (var joint in joints)
|
||||
joint.QueueFree();
|
||||
joints.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnProfileChange(string name) {
|
||||
GD.Print("Profile changed to:");
|
||||
GD.Print(name);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue