diff --git a/ProjectObsidian.csproj b/ProjectObsidian.csproj
index 4cc43f1..9c1c632 100644
--- a/ProjectObsidian.csproj
+++ b/ProjectObsidian.csproj
@@ -13,6 +13,11 @@
$(HOME)/.steam/steam/steamapps/common/Resonite/
/mnt/LocalDisk2/SteamLibrary/steamapps/common/Resonite/
+
+
+
+
+
$(ResonitePath)Resonite_Data/Managed/Elements.Core.dll
@@ -33,7 +38,4 @@
$(ResonitePath)Resonite_Data/Managed/ProtoFluxBindings.dll
-
-
-
diff --git a/ProtoFlux/Bindings/Math/Physics/PotentialEnergyCalculationBinding.CS b/ProtoFlux/Bindings/Math/Physics/PotentialEnergyCalculationBinding.CS
deleted file mode 100644
index f042147..0000000
--- a/ProtoFlux/Bindings/Math/Physics/PotentialEnergyCalculationBinding.CS
+++ /dev/null
@@ -1,76 +0,0 @@
-using FrooxEngine.ProtoFlux;
-using ProtoFlux.Runtimes.Execution;
-using System;
-
-namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Physics
-{
- [Category("Obsidian/Math/Physics")]
- public class PotentialEnergyCalculationBinding : FrooxEngine.ProtoFlux.Runtimes.Execution.NodeBinding
- {
- public readonly SyncRef> Mass;
- public readonly SyncRef> Height;
-
- public override Type NodeType => typeof(PotentialEnergyCalculationNode);
-
- public PotentialEnergyCalculationNode TypedNodeInstance { get; private set; }
-
- public override INode NodeInstance => TypedNodeInstance;
-
- public override int NodeInputCount => base.NodeInputCount + 2;
-
- public override TN Instantiate()
- {
- try
- {
- if (TypedNodeInstance != null)
- throw new InvalidOperationException("Node has already been instantiated");
-
- var instance = (TypedNodeInstance = new PotentialEnergyCalculationNode());
- return instance as TN;
- }
- catch (Exception ex)
- {
- UniLog.Log($"Error in PotentialEnergyCalculationBinding.Instantiate: {ex.Message}");
- throw;
- }
- }
-
- protected override void AssociateInstanceInternal(INode node)
- {
- try
- {
- if (node is not PotentialEnergyCalculationNode typedNodeInstance)
- throw new ArgumentException("Node instance is not of type " + typeof(PotentialEnergyCalculationNode));
-
- TypedNodeInstance = typedNodeInstance;
- }
- catch (Exception ex)
- {
- UniLog.Log($"Error in PotentialEnergyCalculationBinding.AssociateInstanceInternal: {ex.Message}");
- throw;
- }
- }
-
- public override void ClearInstance() => TypedNodeInstance = null;
-
- protected override ISyncRef GetInputInternal(ref int index)
- {
- var inputInternal = base.GetInputInternal(ref index);
- if (inputInternal != null)
- {
- return inputInternal;
- }
-
- switch (index)
- {
- case 0:
- return Mass;
- case 1:
- return Height;
- default:
- index -= 2;
- return null;
- }
- }
- }
-}
diff --git a/ProtoFlux/Bindings/Math/Physics/ProjectileMotionBinding.cs b/ProtoFlux/Bindings/Math/Physics/ProjectileMotionBinding.cs
deleted file mode 100644
index e13440e..0000000
--- a/ProtoFlux/Bindings/Math/Physics/ProjectileMotionBinding.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-using System;
-using FrooxEngine;
-using FrooxEngine.ProtoFlux;
-
-namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Physics
-{
- [Category("Obsidian/Math/Physics")]
- public class ProjectileMotionCalculation : FrooxEngine.ProtoFlux.Runtimes.Execution.ValueFunctionNodeBinding
- {
- public readonly SyncRef> InitialVelocity;
- public readonly SyncRef> LaunchAngle;
- public readonly SyncRef> Gravity;
-
- public override TN Instantiate()
- {
- try
- {
- if (NodeInstance != null)
- throw new InvalidOperationException("Node has already been instantiated");
- var projectileMotionInstance = (NodeInstance = new ProjectileMotionNode());
- return projectileMotionInstance as TN;
- }
- catch (Exception ex)
- {
- UniLog.Log($"Error in ProjectileMotionCalculation.Instantiate: {ex.Message}");
- throw;
- }
- }
-
- protected override void AssociateInstanceInternal(INode node)
- {
- try
- {
- if (node is not ProjectileMotionNode typedNodeInstance)
- throw new ArgumentException("Node instance is not of type " + typeof(ProjectileMotionNode));
- NodeInstance = typedNodeInstance;
- }
- catch (Exception ex)
- {
- UniLog.Log($"Error in ProjectileMotionCalculation.AssociateInstanceInternal: {ex.Message}");
- throw;
- }
- }
-
- public override void ClearInstance() => NodeInstance = null;
-
- protected override ISyncRef GetInputInternal(ref int index)
- {
- var inputInternal = base.GetInputInternal(ref index);
- if (inputInternal != null)
- {
- return inputInternal;
- }
- switch (index)
- {
- case 0:
- return InitialVelocity;
- case 1:
- return LaunchAngle;
- case 2:
- return Gravity;
- default:
- index -= 3;
- return null;
- }
- }
- }
-}
diff --git a/ProtoFlux/Bindings/Math/Physics/RefractNodeBinding.cs b/ProtoFlux/Bindings/Math/Physics/RefractNodeBinding.cs
index add0e62..a7e97f4 100644
--- a/ProtoFlux/Bindings/Math/Physics/RefractNodeBinding.cs
+++ b/ProtoFlux/Bindings/Math/Physics/RefractNodeBinding.cs
@@ -4,6 +4,7 @@
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;
using ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Physics;
+using Elements.Core;
[Category(new string[] { "ProtoFlux/Runtimes/Execution/Nodes/Obsidian/Math/Physics" })]
public class RefractionCalculation : FrooxEngine.ProtoFlux.Runtimes.Execution.ValueFunctionNode
diff --git a/ProtoFlux/Math/Physics/PotentialEnergyCalculationNode b/ProtoFlux/Math/Physics/PotentialEnergyCalculationNode
deleted file mode 100644
index 1f5470d..0000000
--- a/ProtoFlux/Math/Physics/PotentialEnergyCalculationNode
+++ /dev/null
@@ -1,34 +0,0 @@
-using Elements.Core;
-using ProtoFlux.Core;
-using ProtoFlux.Runtimes.Execution;
-using System;
-
-namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Physics
-{
- [NodeCategory("Obsidian/Math/Physics")]
- public class PotentialEnergyCalculationNode : ValueFunctionNode
- {
- public ValueInput Mass;
- public ValueInput Height;
-
- protected override float Compute(ExecutionContext context)
- {
- try
- {
- float mass = Mass.Evaluate(context);
- float height = Height.Evaluate(context);
-
- float potentialEnergy = mass * Constants.G * height;
-
- return potentialEnergy;
- }
- catch (Exception ex)
- {
- // Log any exceptions without throwing them
- UniLog.Log($"Error in PotentialEnergyCalculationNode.Compute: {ex.Message}");
- }
-
- return 0.0f; // Return a default value in case of an error
- }
- }
-}
diff --git a/ProtoFlux/Math/Physics/ProjectileMotionNode.cs b/ProtoFlux/Math/Physics/ProjectileMotionNode.cs
deleted file mode 100644
index 3ddcd52..0000000
--- a/ProtoFlux/Math/Physics/ProjectileMotionNode.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using FrooxEngine;
-using FrooxEngine.ProtoFlux;
-
-namespace ProtoFlux.Runtimes.Execution.Nodes.Obsidian.Math.Physics
-{
- [NodeCategory("Obsidian/Math/Physics")]
- public class ProjectileMotionNode : ValueFunctionNode
- {
- public ValueInput InitialVelocity;
- public ValueInput LaunchAngle;
- public ValueInput Gravity;
-
- protected override float3 Compute(ExecutionContext context)
- {
- float initialVelocity = InitialVelocity.Evaluate(context);
- float launchAngle = LaunchAngle.Evaluate(context);
- float gravity = Gravity.Evaluate(context);
-
- // Convert launch angle to radians
- float launchAngleRad = launchAngle * Mathf.Deg2Rad;
-
- // Calculate horizontal and vertical components of velocity
- float horizontalVelocity = initialVelocity * Mathf.Cos(launchAngleRad);
- float verticalVelocity = initialVelocity * Mathf.Sin(launchAngleRad);
-
- // Calculate time of flight
- float timeOfFlight = (2 * verticalVelocity) / gravity;
-
- // Calculate horizontal position at time of flight
- float horizontalPosition = horizontalVelocity * timeOfFlight;
-
- // Calculate maximum height reached
- float maxHeight = (verticalVelocity * verticalVelocity) / (2 * gravity);
-
- return new float3(horizontalPosition, maxHeight, timeOfFlight);
- }
- }
-}
diff --git a/ProtoFlux/Math/Physics/RefractCalculationNode.cs b/ProtoFlux/Math/Physics/RefractCalculationNode.cs
index df862f7..d317375 100644
--- a/ProtoFlux/Math/Physics/RefractCalculationNode.cs
+++ b/ProtoFlux/Math/Physics/RefractCalculationNode.cs
@@ -1,3 +1,4 @@
+using Elements.Core;
using FrooxEngine;
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;
@@ -16,15 +17,15 @@ protected override float Compute(ExecutionContext context)
{
float n1 = RefractiveIndex1.Evaluate(context);
float n2 = RefractiveIndex2.Evaluate(context);
- float theta1Rad = AngleOfIncidence.Evaluate(context) * (float)Math.PI / 180.0f;
+ float theta1Rad = AngleOfIncidence.Evaluate(context) * (float)MathX.PI / 180.0f;
// Calculate using Snell's Law
- float sinTheta2 = n1 * (float)Math.Sin(theta1Rad) / n2;
+ float sinTheta2 = n1 * (float)MathX.Sin(theta1Rad) / n2;
// Ensure value is within [-1, 1] due to numerical inaccuracies
- sinTheta2 = Math.Min(Math.Max(sinTheta2, -1.0f), 1.0f);
+ sinTheta2 = MathX.Min(MathX.Max(sinTheta2, -1.0f), 1.0f);
- float theta2Rad = (float)Math.Asin(sinTheta2);
- return theta2Rad * 180.0f / (float)Math.PI;
+ float theta2Rad = (float)MathX.Asin(sinTheta2);
+ return theta2Rad * 180.0f / (float)MathX.PI;
}
}
}