add some extra assets FX and SFX

This commit is contained in:
Robii Aragon
2026-03-29 23:03:14 -07:00
parent 6ef3eb1535
commit 24dc66a81e
10142 changed files with 2535978 additions and 36608 deletions

View File

@@ -0,0 +1,55 @@
using System;
using UnityEngine;
namespace NobleMuffins.LimbHacker.Guts
{
public static class VectorExtensions
{
public static Vector3 ClampNormalToBicone(this Vector3 normal, Vector3 axis, float maximumDegrees)
{
var minimumDotProduct = Mathf.Cos(maximumDegrees * Mathf.Deg2Rad);
var dotProduct = Vector3.Dot(normal, axis);
var result = normal;
if (Mathf.Abs(dotProduct) < minimumDotProduct)
{
var sign = Mathf.Sign(dotProduct);
var differenceBetweenNowAndIdeal = minimumDotProduct - Mathf.Abs(dotProduct);
var repairativeContribution = axis * differenceBetweenNowAndIdeal * sign;
var currentCorrective = 1f;
var lowCorrective = 1f;
var highCorrective = 100f;
var iterations = 16;
while (iterations > 0)
{
result = (normal + repairativeContribution * currentCorrective).normalized;
float dp = Mathf.Abs(Vector3.Dot(result, axis));
if (dp > minimumDotProduct)
{
highCorrective = currentCorrective;
currentCorrective = (currentCorrective + lowCorrective) / 2f;
}
else if (dp < minimumDotProduct)
{
lowCorrective = currentCorrective;
currentCorrective = (currentCorrective + highCorrective) / 2f;
}
iterations--;
}
}
return result;
}
}
}