stop fucking formatting my files godot
This commit is contained in:
parent
c8139edf2a
commit
f8f1cbaab7
|
@ -22,6 +22,10 @@ project/assembly_name="nordic25"
|
||||||
|
|
||||||
import/blender/enabled=false
|
import/blender/enabled=false
|
||||||
|
|
||||||
|
[rendering]
|
||||||
|
|
||||||
|
renderer/rendering_method="mobile"
|
||||||
|
|
||||||
[xr]
|
[xr]
|
||||||
|
|
||||||
openxr/enabled=true
|
openxr/enabled=true
|
||||||
|
|
|
@ -48,6 +48,7 @@ transform = Transform3D(1, 0, 0, 0, -0.837394, -0.546599, 0, 0.546599, -0.837394
|
||||||
shape = SubResource("CapsuleShape3D_74lek")
|
shape = SubResource("CapsuleShape3D_74lek")
|
||||||
|
|
||||||
[node name="Player" parent="." instance=ExtResource("2_iyx0m")]
|
[node name="Player" parent="." instance=ExtResource("2_iyx0m")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.576159)
|
||||||
|
|
||||||
[node name="test pellet" parent="." instance=ExtResource("3_iyx0m")]
|
[node name="test pellet" parent="." instance=ExtResource("3_iyx0m")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00932735, 0.01, -0.0187979)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00932735, 0.01, -0.0187979)
|
||||||
|
|
|
@ -3,45 +3,48 @@ using Godot;
|
||||||
public partial class Mouth : XRCamera3D
|
public partial class Mouth : XRCamera3D
|
||||||
{
|
{
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
public float MaxEatWeight = 1.0f;
|
public float MaxEatWeight = 1.0f;
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
public float EatGrowthFactor = 0.1f;
|
public float EatGrowthFactor = 0.1f;
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
public XRHand RightHand;
|
public XRHand RightHand;
|
||||||
[Export]
|
[Export]
|
||||||
public XRHand LeftHand;
|
public XRHand LeftHand;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
UpdateWeights();
|
UpdateWeights();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EnterMouth(Node node)
|
public void EnterMouth(Node node)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
RigidBody3D body = (RigidBody3D)node;
|
RigidBody3D body = (RigidBody3D)node;
|
||||||
if (body.Mass > MaxEatWeight)
|
if (body.Mass > MaxEatWeight)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UpdateWeights(body.Mass);
|
UpdateWeights(body.Mass);
|
||||||
|
}
|
||||||
|
catch (System.InvalidCastException)
|
||||||
|
{
|
||||||
|
// dont give a shit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
void UpdateWeights(float mass = 0f)
|
||||||
catch (System.InvalidCastException)
|
{
|
||||||
{
|
GD.Print("Ate ", mass, "kg");
|
||||||
// dont give a shit
|
MaxEatWeight += (mass / MaxEatWeight) * EatGrowthFactor;
|
||||||
}
|
float WorldScale = 1.0f / MaxEatWeight;
|
||||||
}
|
((XROrigin3D)GetParent()).WorldScale = WorldScale;
|
||||||
|
RightHand.Strength = MaxEatWeight;
|
||||||
void UpdateWeights(float mass = 0f)
|
LeftHand.Strength = MaxEatWeight;
|
||||||
{
|
GD.Print("New MaxEatWeight: ", MaxEatWeight);
|
||||||
MaxEatWeight += (mass / MaxEatWeight) * EatGrowthFactor;
|
GD.Print("New WorldScale: ", WorldScale);
|
||||||
((XROrigin3D)GetParent()).WorldScale = 1.0f / MaxEatWeight;
|
}
|
||||||
RightHand.Strength = MaxEatWeight;
|
|
||||||
LeftHand.Strength = MaxEatWeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,76 +3,64 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
public partial class XRHand : XRController3D
|
public partial class XRHand : XRController3D
|
||||||
{
|
{
|
||||||
List<Generic6DofJoint3D> joints = new();
|
List<PinJoint3D> joints = new();
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
StaticBody3D body;
|
StaticBody3D body;
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
public float Strength = 1.0f;
|
public float Strength = 1.0f;
|
||||||
|
|
||||||
public override void _Process(double delta)
|
public void OnPress(string name)
|
||||||
{
|
{
|
||||||
if ((bool)GetInput("trigger_click"))
|
if (name == "select_button")
|
||||||
{
|
{
|
||||||
}
|
var query = new PhysicsShapeQueryParameters3D();
|
||||||
else if (joints.Count > 0)
|
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 void OnPress(string name)
|
if (body.Mass > Strength)
|
||||||
{
|
continue;
|
||||||
if (name == "select_button")
|
|
||||||
{
|
|
||||||
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)
|
PinJoint3D joint = new();
|
||||||
{
|
joint.NodeA = GetPathTo(body);
|
||||||
continue;
|
joint.NodeB = body.GetPath();
|
||||||
}
|
joints.Add(joint);
|
||||||
|
AddChild(joint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Generic6DofJoint3D joint = new();
|
public void OnRelease(string name)
|
||||||
joint.NodeA = GetPathTo(body);
|
{
|
||||||
joint.NodeB = body.GetPath();
|
if (name == "select_button")
|
||||||
joints.Add(joint);
|
{
|
||||||
AddChild(joint);
|
foreach (var joint in joints)
|
||||||
}
|
joint.QueueFree();
|
||||||
}
|
joints.Clear();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void OnRelease(string name)
|
public void OnFloat(string name, float value)
|
||||||
{
|
{
|
||||||
if (name == "select_button")
|
// GD.Print("Float input:");
|
||||||
{
|
// GD.Print(name);
|
||||||
foreach (var joint in joints)
|
// GD.Print(value);
|
||||||
joint.QueueFree();
|
}
|
||||||
joints.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnFloat(string name, float value)
|
|
||||||
{
|
|
||||||
// GD.Print("Float input:");
|
|
||||||
// GD.Print(name);
|
|
||||||
// GD.Print(value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,17 +3,17 @@ using System;
|
||||||
|
|
||||||
public partial class XrOrigin3d : XROrigin3D
|
public partial class XrOrigin3d : XROrigin3D
|
||||||
{
|
{
|
||||||
private XRInterface _xrInterface;
|
private XRInterface _xrInterface;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_xrInterface = XRServer.FindInterface("OpenXR");
|
_xrInterface = XRServer.FindInterface("OpenXR");
|
||||||
if (_xrInterface == null || !_xrInterface.IsInitialized())
|
if (_xrInterface == null || !_xrInterface.IsInitialized())
|
||||||
GD.PushError("Failed to initialize OpenXR");
|
GD.PushError("Failed to initialize OpenXR");
|
||||||
|
|
||||||
GD.PushError("OpenXR Initialized successfully");
|
GD.Print("OpenXR Initialized successfully");
|
||||||
|
|
||||||
DisplayServer.WindowSetVsyncMode(DisplayServer.VSyncMode.Disabled);
|
DisplayServer.WindowSetVsyncMode(DisplayServer.VSyncMode.Disabled);
|
||||||
GetViewport().UseXR = true;
|
GetViewport().UseXR = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue