Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Dynamic Bone Burst v1.0.1
plugins/DynamicBoneBurst.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using Unity.Burst; using Unity.Collections; using Unity.Jobs; using Unity.Mathematics; using UnityEngine; using UnityEngine.Jobs; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace DynamicBoneBurst { public enum BoneFreezeAxis : byte { None, X, Y, Z } public enum ColliderDirection : byte { X, Y, Z } public enum ColliderBound : byte { Outside, Inside } public struct DynamicBoneRegistration { public Transform OwnerTransform; public Transform Root; public float UpdateRate; public bool IsAnimatePhysics; public float Damping; public AnimationCurve DampingDistrib; public float Elasticity; public AnimationCurve ElasticityDistrib; public float Stiffness; public AnimationCurve StiffnessDistrib; public float Inert; public AnimationCurve InertDistrib; public float Radius; public AnimationCurve RadiusDistrib; public float EndLength; public Vector3 EndOffset; public Vector3 Gravity; public Vector3 Force; public BoneFreezeAxis FreezeAxis; public bool DistantDisable; public Transform ReferenceObject; public float DistanceToObject; public float Weight; public bool Enabled; public IList<Transform> Exclusions; public IList<int> ColliderHandles; } public struct BoneState { public int ParticleStart; public int ParticleCount; public int ColliderStart; public int ColliderCount; public int RefTransformIndex; public float UpdateRate; public float Time; public float Weight; public float DistanceToObject; public float ObjectScale; public float3 Gravity; public float3 LocalGravity; public float3 Force; public float3 ObjectMove; public float3 ObjectPrevPosition; public byte FreezeAxis; public byte DistantDisable; public byte DistantDisabled; public byte IsAnimatePhysics; public byte Enabled; public byte NeedsReset; public byte AppliedThisFrame; } public struct ParticleData { public int BoneIndex; public int ParentLocalIndex; public int TransformIndex; public int ChildCount; public float Damping; public float Elasticity; public float Stiffness; public float Inert; public float Radius; public float BoneLength; public float3 Position; public float3 PrevPosition; public float3 EndOffset; public float3 InitLocalPosition; public quaternion InitLocalRotation; public quaternion TempWorldRotation; } public struct ParticleTransformSnapshot { public float4x4 LocalToWorld; public float3 WorldPosition; public quaternion WorldRotation; public float3 LocalPosition; public quaternion LocalRotation; public byte IsValid; } public struct OwnerTransformSnapshot { public float3 WorldPosition; public float AbsLossyScaleX; public byte IsValid; } public struct RefTransformSnapshot { public float3 WorldPosition; public byte IsValid; } public struct ParticleOutput { public float3 TargetLocalPosition; public quaternion TargetLocalRotation; public int ApplyMask; } public struct ColliderConfig { public float3 Center; public float Radius; public float Height; public byte Direction; public byte Bound; public byte Enabled; } public struct ColliderWorldData { public float3 WorldP0; public float3 WorldP1; public float WorldRadius; public byte IsCapsule; public byte Bound; public byte IsActive; } public static class DynamicBoneMath { [MethodImpl(MethodImplOptions.AggressiveInlining)] public static float ExtractAbsLossyScaleX(in float4x4 localToWorld, quaternion worldRotation) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) float3 val = math.mul(worldRotation, new float3(1f, 0f, 0f)); float4 c = localToWorld.c0; return math.abs(math.dot(val, ((float4)(ref c)).xyz)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static float3 TransformPoint(in float4x4 localToWorld, float3 localPoint) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) float4 val = localToWorld.c0; float3 val2 = ((float4)(ref val)).xyz * localPoint.x; val = localToWorld.c1; float3 val3 = val2 + ((float4)(ref val)).xyz * localPoint.y; val = localToWorld.c2; float3 val4 = val3 + ((float4)(ref val)).xyz * localPoint.z; val = localToWorld.c3; return val4 + ((float4)(ref val)).xyz; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static float3 MultiplyVector(in float4x4 localToWorld, float3 localVector) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) float4 val = localToWorld.c0; float3 val2 = ((float4)(ref val)).xyz * localVector.x; val = localToWorld.c1; float3 val3 = val2 + ((float4)(ref val)).xyz * localVector.y; val = localToWorld.c2; return val3 + ((float4)(ref val)).xyz * localVector.z; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static quaternion FromToRotation(float3 from, float3 to) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) float num = math.lengthsq(from); float num2 = math.lengthsq(to); if (num < 1E-12f || num2 < 1E-12f) { return quaternion.identity; } float3 val = from * math.rsqrt(num); float3 val2 = to * math.rsqrt(num2); float num3 = math.dot(val, val2); if (num3 >= 0.999999f) { return quaternion.identity; } if (num3 <= -0.999999f) { float3 val3 = math.cross(new float3(1f, 0f, 0f), val); if (math.lengthsq(val3) < 1E-06f) { val3 = math.cross(new float3(0f, 1f, 0f), val); } val3 = math.normalize(val3); return new quaternion(val3.x, val3.y, val3.z, 0f); } float3 val4 = math.cross(val, val2); return new quaternion(math.normalize(new float4(val4.x, val4.y, val4.z, 1f + num3))); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Collide(in ColliderWorldData collider, ref float3 particlePosition, float particleRadius) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (collider.IsCapsule == 0) { if (collider.Bound == 0) { OutsideSphere(ref particlePosition, particleRadius, collider.WorldP0, collider.WorldRadius); } else { InsideSphere(ref particlePosition, particleRadius, collider.WorldP0, collider.WorldRadius); } } else if (collider.Bound == 0) { OutsideCapsule(ref particlePosition, particleRadius, collider.WorldP0, collider.WorldP1, collider.WorldRadius); } else { InsideCapsule(ref particlePosition, particleRadius, collider.WorldP0, collider.WorldP1, collider.WorldRadius); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void OutsideSphere(ref float3 particlePosition, float particleRadius, float3 sphereCenter, float sphereRadius) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) float num = sphereRadius + particleRadius; float num2 = num * num; float3 val = particlePosition - sphereCenter; float num3 = math.lengthsq(val); if (num3 > 0f && num3 < num2) { float num4 = math.sqrt(num3); particlePosition = sphereCenter + val * (num / num4); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void InsideSphere(ref float3 particlePosition, float particleRadius, float3 sphereCenter, float sphereRadius) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) float num = sphereRadius - particleRadius; float num2 = num * num; float3 val = particlePosition - sphereCenter; float num3 = math.lengthsq(val); if (num3 > num2) { float num4 = math.sqrt(num3); particlePosition = sphereCenter + val * (num / num4); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void OutsideCapsule(ref float3 particlePosition, float particleRadius, float3 capsuleP0, float3 capsuleP1, float capsuleRadius) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) float num = capsuleRadius + particleRadius; float num2 = num * num; float3 val = capsuleP1 - capsuleP0; float3 val2 = particlePosition - capsuleP0; float num3 = math.dot(val2, val); if (num3 <= 0f) { float num4 = math.lengthsq(val2); if (num4 > 0f && num4 < num2) { float num5 = math.sqrt(num4); particlePosition = capsuleP0 + val2 * (num / num5); } return; } float num6 = math.lengthsq(val); if (num3 >= num6) { val2 = particlePosition - capsuleP1; float num7 = math.lengthsq(val2); if (num7 > 0f && num7 < num2) { float num8 = math.sqrt(num7); particlePosition = capsuleP1 + val2 * (num / num8); } } else if (num6 > 0f) { num3 /= num6; val2 -= val * num3; float num9 = math.lengthsq(val2); if (num9 > 0f && num9 < num2) { float num10 = math.sqrt(num9); particlePosition += val2 * ((num - num10) / num10); } } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void InsideCapsule(ref float3 particlePosition, float particleRadius, float3 capsuleP0, float3 capsuleP1, float capsuleRadius) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) float num = capsuleRadius - particleRadius; float num2 = num * num; float3 val = capsuleP1 - capsuleP0; float3 val2 = particlePosition - capsuleP0; float num3 = math.dot(val2, val); if (num3 <= 0f) { float num4 = math.lengthsq(val2); if (num4 > num2) { float num5 = math.sqrt(num4); particlePosition = capsuleP0 + val2 * (num / num5); } return; } float num6 = math.lengthsq(val); if (num3 >= num6) { val2 = particlePosition - capsuleP1; float num7 = math.lengthsq(val2); if (num7 > num2) { float num8 = math.sqrt(num7); particlePosition = capsuleP1 + val2 * (num / num8); } } else if (num6 > 0f) { num3 /= num6; val2 -= val * num3; float num9 = math.lengthsq(val2); if (num9 > num2) { float num10 = math.sqrt(num9); particlePosition += val2 * ((num - num10) / num10); } } } } [BurstCompile(/*Could not decode attribute arguments.*/)] public struct ReadOwnerTransformsJob : IJobParallelForTransform { [WriteOnly] public NativeArray<OwnerTransformSnapshot> OwnerSnapshots; public void Execute(int index, TransformAccess transform) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (!((TransformAccess)(ref transform)).isValid) { OwnerSnapshots[index] = default(OwnerTransformSnapshot); return; } Vector3 val = default(Vector3); Quaternion val2 = default(Quaternion); ((TransformAccess)(ref transform)).GetPositionAndRotation(ref val, ref val2); float4x4 localToWorld = float4x4.op_Implicit(((TransformAccess)(ref transform)).localToWorldMatrix); OwnerSnapshots[index] = new OwnerTransformSnapshot { WorldPosition = float3.op_Implicit(val), AbsLossyScaleX = DynamicBoneMath.ExtractAbsLossyScaleX(in localToWorld, quaternion.op_Implicit(val2)), IsValid = 1 }; } } [BurstCompile(/*Could not decode attribute arguments.*/)] public struct ReadReferenceTransformsJob : IJobParallelForTransform { [WriteOnly] public NativeArray<RefTransformSnapshot> RefSnapshots; public void Execute(int index, TransformAccess transform) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (!((TransformAccess)(ref transform)).isValid) { RefSnapshots[index] = default(RefTransformSnapshot); return; } RefSnapshots[index] = new RefTransformSnapshot { WorldPosition = float3.op_Implicit(((TransformAccess)(ref transform)).position), IsValid = 1 }; } } [BurstCompile(/*Could not decode attribute arguments.*/)] public struct ReadParticleTransformsJob : IJobParallelForTransform { [ReadOnly] public NativeArray<int> TransformToParticle; [NativeDisableParallelForRestriction] [WriteOnly] public NativeArray<ParticleTransformSnapshot> ParticleSnapshots; public void Execute(int index, TransformAccess transform) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) int num = TransformToParticle[index]; if (!((TransformAccess)(ref transform)).isValid) { ParticleSnapshots[num] = default(ParticleTransformSnapshot); return; } Vector3 val = default(Vector3); Quaternion val2 = default(Quaternion); ((TransformAccess)(ref transform)).GetPositionAndRotation(ref val, ref val2); Vector3 val3 = default(Vector3); Quaternion val4 = default(Quaternion); ((TransformAccess)(ref transform)).GetLocalPositionAndRotation(ref val3, ref val4); ParticleSnapshots[num] = new ParticleTransformSnapshot { LocalToWorld = float4x4.op_Implicit(((TransformAccess)(ref transform)).localToWorldMatrix), WorldPosition = float3.op_Implicit(val), WorldRotation = quaternion.op_Implicit(val2), LocalPosition = float3.op_Implicit(val3), LocalRotation = quaternion.op_Implicit(val4), IsValid = 1 }; } } [BurstCompile(/*Could not decode attribute arguments.*/)] public struct PrepareCollidersJob : IJobParallelForTransform { [ReadOnly] public NativeArray<ColliderConfig> ColliderConfigs; [WriteOnly] public NativeArray<ColliderWorldData> CollidersWorld; public void Execute(int index, TransformAccess transform) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) ColliderConfig colliderConfig = ColliderConfigs[index]; if (colliderConfig.Enabled == 0 || !((TransformAccess)(ref transform)).isValid) { CollidersWorld[index] = default(ColliderWorldData); return; } float4x4 localToWorld = float4x4.op_Implicit(((TransformAccess)(ref transform)).localToWorldMatrix); quaternion worldRotation = quaternion.op_Implicit(((TransformAccess)(ref transform)).rotation); float num = DynamicBoneMath.ExtractAbsLossyScaleX(in localToWorld, worldRotation); float worldRadius = colliderConfig.Radius * num; float num2 = colliderConfig.Height * 0.5f - colliderConfig.Radius; if (num2 <= 0f) { CollidersWorld[index] = new ColliderWorldData { WorldP0 = DynamicBoneMath.TransformPoint(in localToWorld, colliderConfig.Center), WorldP1 = float3.zero, WorldRadius = worldRadius, IsCapsule = 0, Bound = colliderConfig.Bound, IsActive = 1 }; return; } float3 center = colliderConfig.Center; float3 center2 = colliderConfig.Center; switch ((ColliderDirection)colliderConfig.Direction) { case ColliderDirection.X: center.x -= num2; center2.x += num2; break; case ColliderDirection.Y: center.y -= num2; center2.y += num2; break; case ColliderDirection.Z: center.z -= num2; center2.z += num2; break; } CollidersWorld[index] = new ColliderWorldData { WorldP0 = DynamicBoneMath.TransformPoint(in localToWorld, center), WorldP1 = DynamicBoneMath.TransformPoint(in localToWorld, center2), WorldRadius = worldRadius, IsCapsule = 1, Bound = colliderConfig.Bound, IsActive = 1 }; } } [BurstCompile(/*Could not decode attribute arguments.*/)] public struct SimulateDynamicBonesJob : IJobParallelFor { public float DeltaTime; public float3 MainCameraPosition; public byte HasMainCamera; public NativeArray<BoneState> Bones; [NativeDisableParallelForRestriction] public NativeArray<ParticleData> Particles; [NativeDisableParallelForRestriction] public NativeArray<ParticleOutput> ParticleOutputs; [ReadOnly] public NativeArray<ParticleTransformSnapshot> ParticleSnapshots; [ReadOnly] public NativeArray<OwnerTransformSnapshot> OwnerSnapshots; [ReadOnly] public NativeArray<RefTransformSnapshot> RefSnapshots; [ReadOnly] public NativeArray<int> BoneColliderHandles; [ReadOnly] public NativeArray<int> ColliderHandleToDense; [ReadOnly] public NativeArray<ColliderWorldData> CollidersWorld; public void Execute(int boneIndex) { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) BoneState bone = Bones[boneIndex]; bone.AppliedThisFrame = 0; if (bone.Enabled == 0 || bone.ParticleCount <= 0) { Bones[boneIndex] = bone; return; } OwnerTransformSnapshot ownerSnap = OwnerSnapshots[boneIndex]; ParticleData particleData = Particles[bone.ParticleStart]; ParticleTransformSnapshot rootSnap = ParticleSnapshots[bone.ParticleStart]; if (ownerSnap.IsValid == 0 || particleData.TransformIndex < 0 || rootSnap.IsValid == 0) { Bones[boneIndex] = bone; return; } if (bone.NeedsReset != 0) { ResetParticlesPosition(ref bone, ownerSnap.WorldPosition); bone.NeedsReset = 0; } if (bone.DistantDisable != 0) { CheckDistance(ref bone, ownerSnap.WorldPosition); } if (bone.Weight > 0f && (bone.DistantDisable == 0 || bone.DistantDisabled == 0)) { UpdateDynamicBones(ref bone, in ownerSnap, in rootSnap); bone.AppliedThisFrame = 1; } Bones[boneIndex] = bone; } private void CheckDistance(ref BoneState bone, float3 ownerPosition) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) float3 val; if (bone.RefTransformIndex >= 0 && RefSnapshots[bone.RefTransformIndex].IsValid != 0) { val = RefSnapshots[bone.RefTransformIndex].WorldPosition; } else { if (HasMainCamera == 0) { return; } val = MainCameraPosition; } float distanceToObject = bone.DistanceToObject; bool flag = math.lengthsq(val - ownerPosition) > distanceToObject * distanceToObject; if (flag != (bone.DistantDisabled != 0)) { if (!flag) { ResetParticlesPosition(ref bone, ownerPosition); } bone.DistantDisabled = (byte)(flag ? 1 : 0); } } private void ResetParticlesPosition(ref BoneState bone, float3 ownerPosition) { //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) int particleStart = bone.ParticleStart; int particleCount = bone.ParticleCount; for (int i = 0; i < particleCount; i++) { int num = particleStart + i; ParticleData particleData = Particles[num]; if (particleData.TransformIndex >= 0 && ParticleSnapshots[num].IsValid != 0) { particleData.PrevPosition = (particleData.Position = ParticleSnapshots[num].WorldPosition); } else if (particleData.ParentLocalIndex >= 0) { int num2 = particleStart + particleData.ParentLocalIndex; if (Particles[num2].TransformIndex >= 0 && ParticleSnapshots[num2].IsValid != 0) { ParticleTransformSnapshot particleTransformSnapshot = ParticleSnapshots[num2]; particleData.PrevPosition = (particleData.Position = DynamicBoneMath.TransformPoint(in particleTransformSnapshot.LocalToWorld, particleData.EndOffset)); } } Particles[num] = particleData; } bone.ObjectPrevPosition = ownerPosition; } private void UpdateDynamicBones(ref BoneState bone, in OwnerTransformSnapshot ownerSnap, in ParticleTransformSnapshot rootSnap) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) bone.ObjectScale = ownerSnap.AbsLossyScaleX; bone.ObjectMove = ownerSnap.WorldPosition - bone.ObjectPrevPosition; bone.ObjectPrevPosition = ownerSnap.WorldPosition; int num = 1; if (bone.UpdateRate > 0f) { float num2 = 1f / bone.UpdateRate; bone.Time += DeltaTime; num = 0; while (bone.Time >= num2) { bone.Time -= num2; if (++num >= 3) { bone.Time = 0f; break; } } } if (num > 0) { float3 gravity = bone.Gravity; float3 val = math.normalizesafe(gravity, float3.zero); float3 val2 = math.mul(rootSnap.WorldRotation, bone.LocalGravity); float3 val3 = val * math.max(math.dot(val2, val), 0f); float3 gravityForce = (gravity - val3 + bone.Force) * bone.ObjectScale; for (int i = 0; i < num; i++) { UpdateParticles1(in bone, gravityForce); UpdateParticles2(in bone); bone.ObjectMove = float3.zero; } } else { SkipUpdateParticles(in bone); } ComputeTransformOutputs(in bone); } private void UpdateParticles1(in BoneState bone, float3 gravityForce) { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) int particleStart = bone.ParticleStart; int particleCount = bone.ParticleCount; for (int i = 0; i < particleCount; i++) { int num = particleStart + i; ParticleData particleData = Particles[num]; if (particleData.ParentLocalIndex >= 0) { float3 val = particleData.Position - particleData.PrevPosition; float3 val2 = bone.ObjectMove * particleData.Inert; particleData.PrevPosition = particleData.Position + val2; ref float3 position = ref particleData.Position; position += val * (1f - particleData.Damping) + gravityForce + val2; } else { particleData.PrevPosition = particleData.Position; particleData.Position = ParticleSnapshots[num].WorldPosition; } Particles[num] = particleData; } } private void UpdateParticles2(in BoneState bone) { //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) int particleStart = bone.ParticleStart; int particleCount = bone.ParticleCount; int colliderStart = bone.ColliderStart; int num = colliderStart + bone.ColliderCount; float num2 = math.saturate(bone.Weight); BoneFreezeAxis freezeAxis = (BoneFreezeAxis)bone.FreezeAxis; float3 val3 = default(float3); for (int i = 1; i < particleCount; i++) { int num3 = particleStart + i; ParticleData particleData = Particles[num3]; int num4 = particleStart + particleData.ParentLocalIndex; ParticleData particleData2 = Particles[num4]; ParticleTransformSnapshot particleTransformSnapshot = ParticleSnapshots[num4]; if (particleData2.TransformIndex < 0 || particleTransformSnapshot.IsValid == 0) { continue; } ParticleTransformSnapshot particleTransformSnapshot2 = ParticleSnapshots[num3]; bool flag = particleData.TransformIndex >= 0 && particleTransformSnapshot2.IsValid != 0; float num5 = (flag ? math.length(particleTransformSnapshot.WorldPosition - particleTransformSnapshot2.WorldPosition) : math.length(DynamicBoneMath.MultiplyVector(in particleTransformSnapshot.LocalToWorld, particleData.EndOffset))); float num6 = math.lerp(1f, particleData.Stiffness, num2); if (num6 > 0f || particleData.Elasticity > 0f) { float3 localVector = (flag ? particleTransformSnapshot2.LocalPosition : particleData.EndOffset); float3 val = DynamicBoneMath.MultiplyVector(in particleTransformSnapshot.LocalToWorld, localVector) + particleData2.Position; float3 val2 = val - particleData.Position; ref float3 position = ref particleData.Position; position += val2 * particleData.Elasticity; if (num6 > 0f) { val2 = val - particleData.Position; float num7 = math.length(val2); float num8 = num5 * (1f - num6) * 2f; if (num7 > num8 && num7 > 0f) { ref float3 position2 = ref particleData.Position; position2 += val2 * ((num7 - num8) / num7); } } } if (num > colliderStart) { float particleRadius = particleData.Radius * bone.ObjectScale; for (int j = colliderStart; j < num; j++) { int num9 = BoneColliderHandles[j]; if ((uint)num9 >= (uint)ColliderHandleToDense.Length) { continue; } int num10 = ColliderHandleToDense[num9]; if (num10 >= 0) { ColliderWorldData collider = CollidersWorld[num10]; if (collider.IsActive != 0) { DynamicBoneMath.Collide(in collider, ref particleData.Position, particleRadius); } } } } if (freezeAxis != BoneFreezeAxis.None) { switch (freezeAxis) { case BoneFreezeAxis.X: ((float3)(ref val3))..ctor(1f, 0f, 0f); break; case BoneFreezeAxis.Y: ((float3)(ref val3))..ctor(0f, 1f, 0f); break; default: ((float3)(ref val3))..ctor(0f, 0f, 1f); break; } float3 val4 = math.normalizesafe(math.mul(particleTransformSnapshot.WorldRotation, val3), val3); ref float3 position3 = ref particleData.Position; position3 -= val4 * math.dot(val4, particleData.Position - particleData2.Position); } float3 val5 = particleData2.Position - particleData.Position; float num11 = math.length(val5); if (num11 > 0f) { ref float3 position4 = ref particleData.Position; position4 += val5 * ((num11 - num5) / num11); } Particles[num3] = particleData; } } private void SkipUpdateParticles(in BoneState bone) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) int particleStart = bone.ParticleStart; int particleCount = bone.ParticleCount; float num = math.saturate(bone.Weight); for (int i = 0; i < particleCount; i++) { int num2 = particleStart + i; ParticleData particleData = Particles[num2]; if (particleData.ParentLocalIndex >= 0) { ref float3 prevPosition = ref particleData.PrevPosition; prevPosition += bone.ObjectMove; ref float3 position = ref particleData.Position; position += bone.ObjectMove; int num3 = particleStart + particleData.ParentLocalIndex; ParticleData particleData2 = Particles[num3]; ParticleTransformSnapshot particleTransformSnapshot = ParticleSnapshots[num3]; if (particleData2.TransformIndex < 0 || particleTransformSnapshot.IsValid == 0) { Particles[num2] = particleData; continue; } ParticleTransformSnapshot particleTransformSnapshot2 = ParticleSnapshots[num2]; bool flag = particleData.TransformIndex >= 0 && particleTransformSnapshot2.IsValid != 0; float num4 = (flag ? math.length(particleTransformSnapshot.WorldPosition - particleTransformSnapshot2.WorldPosition) : math.length(DynamicBoneMath.MultiplyVector(in particleTransformSnapshot.LocalToWorld, particleData.EndOffset))); float num5 = math.lerp(1f, particleData.Stiffness, num); if (num5 > 0f) { float3 localVector = (flag ? particleTransformSnapshot2.LocalPosition : particleData.EndOffset); float3 val = DynamicBoneMath.MultiplyVector(in particleTransformSnapshot.LocalToWorld, localVector) + particleData2.Position - particleData.Position; float num6 = math.length(val); float num7 = num4 * (1f - num5) * 2f; if (num6 > num7 && num6 > 0f) { ref float3 position2 = ref particleData.Position; position2 += val * ((num6 - num7) / num6); } } float3 val2 = particleData2.Position - particleData.Position; float num8 = math.length(val2); if (num8 > 0f) { ref float3 position3 = ref particleData.Position; position3 += val2 * ((num8 - num4) / num8); } } else if (particleData.TransformIndex >= 0 && ParticleSnapshots[num2].IsValid != 0) { particleData.PrevPosition = particleData.Position; particleData.Position = ParticleSnapshots[num2].WorldPosition; } Particles[num2] = particleData; } } private void ComputeTransformOutputs(in BoneState bone) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) int particleStart = bone.ParticleStart; int particleCount = bone.ParticleCount; ParticleData particleData = Particles[particleStart]; ParticleTransformSnapshot particleTransformSnapshot = ParticleSnapshots[particleStart]; particleData.TempWorldRotation = particleTransformSnapshot.WorldRotation; Particles[particleStart] = particleData; ParticleOutputs[particleStart] = new ParticleOutput { TargetLocalPosition = particleTransformSnapshot.LocalPosition, TargetLocalRotation = particleTransformSnapshot.LocalRotation, ApplyMask = 0 }; for (int i = 1; i < particleCount; i++) { int num = particleStart + i; ParticleData particleData2 = Particles[num]; int num2 = particleStart + particleData2.ParentLocalIndex; ParticleData particleData3 = Particles[num2]; ParticleTransformSnapshot particleTransformSnapshot2 = ParticleSnapshots[num]; ParticleTransformSnapshot particleTransformSnapshot3 = ParticleSnapshots[num2]; bool flag = particleData2.TransformIndex >= 0 && particleTransformSnapshot2.IsValid != 0; bool flag2 = particleData3.TransformIndex >= 0 && particleTransformSnapshot3.IsValid != 0; if (flag2 && particleData3.ChildCount <= 1) { float3 val = (flag ? particleTransformSnapshot2.LocalPosition : particleData2.EndOffset); float3 to = particleData2.Position - particleData3.Position; quaternion val2 = (particleData3.TempWorldRotation = math.normalizesafe(math.mul(DynamicBoneMath.FromToRotation(math.mul(particleData3.TempWorldRotation, val), to), particleData3.TempWorldRotation), particleData3.TempWorldRotation)); Particles[num2] = particleData3; quaternion val3 = ((particleData2.ParentLocalIndex != 0) ? math.mul(math.inverse(Particles[particleStart + particleData3.ParentLocalIndex].TempWorldRotation), val2) : math.mul(math.mul(particleTransformSnapshot3.LocalRotation, math.inverse(particleTransformSnapshot3.WorldRotation)), val2)); ParticleOutput particleOutput = ParticleOutputs[num2]; particleOutput.TargetLocalRotation = math.normalizesafe(val3, particleTransformSnapshot3.LocalRotation); particleOutput.ApplyMask |= 1; ParticleOutputs[num2] = particleOutput; } if (!flag) { continue; } particleData2.TempWorldRotation = (flag2 ? math.normalizesafe(math.mul(particleData3.TempWorldRotation, particleTransformSnapshot2.LocalRotation), particleTransformSnapshot2.WorldRotation) : particleTransformSnapshot2.WorldRotation); Particles[num] = particleData2; float3 targetLocalPosition = particleTransformSnapshot2.LocalPosition; if (flag2) { float3x3 val4 = math.mul(new float3x3(math.inverse(particleTransformSnapshot3.WorldRotation)), new float3x3(particleTransformSnapshot3.LocalToWorld)); if (math.abs(math.determinant(val4)) > 1E-12f) { float3 val5 = math.mul(math.inverse(particleData3.TempWorldRotation), particleData2.Position - particleData3.Position); targetLocalPosition = math.mul(math.inverse(val4), val5); } } ParticleOutputs[num] = new ParticleOutput { TargetLocalPosition = targetLocalPosition, TargetLocalRotation = particleTransformSnapshot2.LocalRotation, ApplyMask = 2 }; } } } [BurstCompile(/*Could not decode attribute arguments.*/)] public struct ApplyParticleTransformsJob : IJobParallelForTransform { [ReadOnly] public NativeArray<int> TransformToParticle; [ReadOnly] public NativeArray<ParticleData> Particles; [ReadOnly] public NativeArray<BoneState> Bones; [ReadOnly] public NativeArray<ParticleOutput> ParticleOutputs; public void Execute(int index, TransformAccess transform) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) if (!((TransformAccess)(ref transform)).isValid) { return; } int num = TransformToParticle[index]; int boneIndex = Particles[num].BoneIndex; if (Bones[boneIndex].AppliedThisFrame != 0) { ParticleOutput particleOutput = ParticleOutputs[num]; switch (particleOutput.ApplyMask) { case 1: ((TransformAccess)(ref transform)).localRotation = quaternion.op_Implicit(particleOutput.TargetLocalRotation); break; case 2: ((TransformAccess)(ref transform)).localPosition = float3.op_Implicit(particleOutput.TargetLocalPosition); break; case 3: ((TransformAccess)(ref transform)).SetLocalPositionAndRotation(float3.op_Implicit(particleOutput.TargetLocalPosition), quaternion.op_Implicit(particleOutput.TargetLocalRotation)); break; } } } } [BurstCompile(/*Could not decode attribute arguments.*/)] public struct InitParticleTransformsJob : IJobParallelForTransform { public byte TargetAnimatePhysics; [ReadOnly] public NativeArray<int> TransformToParticle; [ReadOnly] public NativeArray<ParticleData> Particles; [ReadOnly] public NativeArray<BoneState> Bones; public void Execute(int index, TransformAccess transform) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) if (((TransformAccess)(ref transform)).isValid) { int num = TransformToParticle[index]; ParticleData particleData = Particles[num]; BoneState boneState = Bones[particleData.BoneIndex]; if (boneState.Enabled != 0 && boneState.IsAnimatePhysics == TargetAnimatePhysics && !(boneState.Weight <= 0f) && (boneState.DistantDisable == 0 || boneState.DistantDisabled == 0)) { ((TransformAccess)(ref transform)).SetLocalPositionAndRotation(float3.op_Implicit(particleData.InitLocalPosition), quaternion.op_Implicit(particleData.InitLocalRotation)); } } } } public sealed class DynamicBoneJobManager : IDisposable { private struct TempParticleSetup { public Transform Transform; public int ParentLocalIndex; public float BoneLength; public Vector3 Position; public Vector3 EndOffset; public Vector3 InitLocalPosition; public Quaternion InitLocalRotation; public int ChildCount; } private const int DefaultBoneCapacity = 64; private const int DefaultParticleCapacity = 512; private const int DefaultColliderCapacity = 64; private const int CompactionThreshold = 256; private NativeList<BoneState> _bones; private NativeList<int> _boneDenseToHandle; private TransformAccessArray _ownerTransforms; private NativeList<OwnerTransformSnapshot> _ownerSnapshots; private NativeList<int> _boneHandleToDense; private readonly Stack<int> _freeBoneHandles = new Stack<int>(); private TransformAccessArray _refTransforms; private NativeList<RefTransformSnapshot> _refSnapshots; private NativeList<int> _refDenseToBoneHandle; private NativeList<ParticleData> _particles; private NativeList<ParticleTransformSnapshot> _particleSnapshots; private NativeList<ParticleOutput> _particleOutputs; private TransformAccessArray _particleTransforms; private NativeList<int> _transformToParticle; private NativeList<int> _boneColliderHandles; private TransformAccessArray _colliderTransforms; private NativeList<ColliderConfig> _colliderConfigs; private NativeList<ColliderWorldData> _collidersWorld; private NativeList<int> _colliderDenseToHandle; private NativeList<int> _colliderHandleToDense; private readonly Stack<int> _freeColliderHandles = new Stack<int>(); private readonly List<TempParticleSetup> _setupScratch = new List<TempParticleSetup>(32); private int _deadParticleCount; private int _deadColliderRefCount; private JobHandle _pendingHandle; private bool _hasPendingJob; private bool _disposed; public int ActiveBoneCount { get { if (!_disposed) { return _bones.Length; } return 0; } } public int ActiveColliderCount { get { if (!_disposed) { return _colliderConfigs.Length; } return 0; } } public int ActiveParticleTransformCount { get { if (!_disposed) { return ((TransformAccessArray)(ref _particleTransforms)).length; } return 0; } } public DynamicBoneJobManager(int initialBoneCapacity = 64, int initialParticleCapacity = 512, int initialColliderCapacity = 64) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) initialBoneCapacity = math.max(initialBoneCapacity, 8); initialParticleCapacity = math.max(initialParticleCapacity, 32); initialColliderCapacity = math.max(initialColliderCapacity, 8); _bones = new NativeList<BoneState>(initialBoneCapacity, AllocatorHandle.op_Implicit((Allocator)4)); _boneDenseToHandle = new NativeList<int>(initialBoneCapacity, AllocatorHandle.op_Implicit((Allocator)4)); _ownerTransforms = new TransformAccessArray(initialBoneCapacity, -1); _ownerSnapshots = new NativeList<OwnerTransformSnapshot>(initialBoneCapacity, AllocatorHandle.op_Implicit((Allocator)4)); _boneHandleToDense = new NativeList<int>(initialBoneCapacity, AllocatorHandle.op_Implicit((Allocator)4)); _refTransforms = new TransformAccessArray(16, -1); _refSnapshots = new NativeList<RefTransformSnapshot>(16, AllocatorHandle.op_Implicit((Allocator)4)); _refDenseToBoneHandle = new NativeList<int>(16, AllocatorHandle.op_Implicit((Allocator)4)); _particles = new NativeList<ParticleData>(initialParticleCapacity, AllocatorHandle.op_Implicit((Allocator)4)); _particleSnapshots = new NativeList<ParticleTransformSnapshot>(initialParticleCapacity, AllocatorHandle.op_Implicit((Allocator)4)); _particleOutputs = new NativeList<ParticleOutput>(initialParticleCapacity, AllocatorHandle.op_Implicit((Allocator)4)); _particleTransforms = new TransformAccessArray(initialParticleCapacity, -1); _transformToParticle = new NativeList<int>(initialParticleCapacity, AllocatorHandle.op_Implicit((Allocator)4)); _boneColliderHandles = new NativeList<int>(initialBoneCapacity * 2, AllocatorHandle.op_Implicit((Allocator)4)); _colliderTransforms = new TransformAccessArray(initialColliderCapacity, -1); _colliderConfigs = new NativeList<ColliderConfig>(initialColliderCapacity, AllocatorHandle.op_Implicit((Allocator)4)); _collidersWorld = new NativeList<ColliderWorldData>(initialColliderCapacity, AllocatorHandle.op_Implicit((Allocator)4)); _colliderDenseToHandle = new NativeList<int>(initialColliderCapacity, AllocatorHandle.op_Implicit((Allocator)4)); _colliderHandleToDense = new NativeList<int>(initialColliderCapacity, AllocatorHandle.op_Implicit((Allocator)4)); } public int RegisterCollider(Transform colliderTransform, Vector3 center, float radius, float height, ColliderDirection direction, ColliderBound bound, bool enabled) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) ThrowIfDisposed(); if ((Object)(object)colliderTransform == (Object)null) { return -1; } CompletePendingJobs(); int num; if (_freeColliderHandles.Count > 0) { num = _freeColliderHandles.Pop(); } else { num = _colliderHandleToDense.Length; ref NativeList<int> colliderHandleToDense = ref _colliderHandleToDense; int num2 = -1; colliderHandleToDense.Add(ref num2); } int length = _colliderConfigs.Length; _colliderHandleToDense[num] = length; _colliderDenseToHandle.Add(ref num); ((TransformAccessArray)(ref _colliderTransforms)).Add(colliderTransform); ref NativeList<ColliderConfig> colliderConfigs = ref _colliderConfigs; ColliderConfig colliderConfig = new ColliderConfig { Center = float3.op_Implicit(center), Radius = math.max(radius, 0f), Height = math.max(height, 0f), Direction = (byte)direction, Bound = (byte)bound, Enabled = (byte)(enabled ? 1 : 0) }; colliderConfigs.Add(ref colliderConfig); ref NativeList<ColliderWorldData> collidersWorld = ref _collidersWorld; ColliderWorldData colliderWorldData = default(ColliderWorldData); collidersWorld.Add(ref colliderWorldData); return num; } public void UnregisterCollider(int colliderHandle) { if (_disposed || colliderHandle < 0 || colliderHandle >= _colliderHandleToDense.Length) { return; } CompletePendingJobs(); int num = _colliderHandleToDense[colliderHandle]; if (num >= 0) { _colliderHandleToDense[colliderHandle] = -1; _freeColliderHandles.Push(colliderHandle); ((TransformAccessArray)(ref _colliderTransforms)).RemoveAtSwapBack(num); _colliderConfigs.RemoveAtSwapBack(num); _collidersWorld.RemoveAtSwapBack(num); _colliderDenseToHandle.RemoveAtSwapBack(num); if (num < _colliderDenseToHandle.Length) { int num2 = _colliderDenseToHandle[num]; _colliderHandleToDense[num2] = num; } } } public void UpdateCollider(int colliderHandle, Vector3 center, float radius, float height, ColliderDirection direction, ColliderBound bound, bool enabled) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) if (!_disposed && colliderHandle >= 0 && colliderHandle < _colliderHandleToDense.Length) { CompletePendingJobs(); int num = _colliderHandleToDense[colliderHandle]; if (num >= 0) { _colliderConfigs[num] = new ColliderConfig { Center = float3.op_Implicit(center), Radius = math.max(radius, 0f), Height = math.max(height, 0f), Direction = (byte)direction, Bound = (byte)bound, Enabled = (byte)(enabled ? 1 : 0) }; } } } public void SetColliderEnabled(int colliderHandle, bool enabled) { if (!_disposed && colliderHandle >= 0 && colliderHandle < _colliderHandleToDense.Length) { CompletePendingJobs(); int num = _colliderHandleToDense[colliderHandle]; if (num >= 0) { ColliderConfig colliderConfig = _colliderConfigs[num]; colliderConfig.Enabled = (byte)(enabled ? 1 : 0); _colliderConfigs[num] = colliderConfig; } } } public int RegisterDynamicBone(in DynamicBoneRegistration reg) { //IL_0491: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_0537: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_0548: Unknown result type (might be due to invalid IL or missing references) //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_054f: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Unknown result type (might be due to invalid IL or missing references) //IL_057f: Unknown result type (might be due to invalid IL or missing references) //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) ThrowIfDisposed(); if ((Object)(object)reg.OwnerTransform == (Object)null || (Object)(object)reg.Root == (Object)null) { return -1; } CompletePendingJobs(); CompactIfNeeded(); _setupScratch.Clear(); float boneTotalLength = 0f; AppendParticlesRecursive(in reg, reg.Root, -1, 0f, ref boneTotalLength); if (_setupScratch.Count == 0) { return -1; } int num; if (_freeBoneHandles.Count > 0) { num = _freeBoneHandles.Pop(); } else { num = _boneHandleToDense.Length; ref NativeList<int> boneHandleToDense = ref _boneHandleToDense; int num2 = -1; boneHandleToDense.Add(ref num2); } int length = _bones.Length; _boneHandleToDense[num] = length; _boneDenseToHandle.Add(ref num); ((TransformAccessArray)(ref _ownerTransforms)).Add(reg.OwnerTransform); ref NativeList<OwnerTransformSnapshot> ownerSnapshots = ref _ownerSnapshots; OwnerTransformSnapshot ownerTransformSnapshot = default(OwnerTransformSnapshot); ownerSnapshots.Add(ref ownerTransformSnapshot); int refTransformIndex = -1; if ((Object)(object)reg.ReferenceObject != (Object)null) { refTransformIndex = ((TransformAccessArray)(ref _refTransforms)).length; ((TransformAccessArray)(ref _refTransforms)).Add(reg.ReferenceObject); ref NativeList<RefTransformSnapshot> refSnapshots = ref _refSnapshots; RefTransformSnapshot refTransformSnapshot = default(RefTransformSnapshot); refSnapshots.Add(ref refTransformSnapshot); _refDenseToBoneHandle.Add(ref num); } int length2 = _particles.Length; int count = _setupScratch.Count; bool flag = reg.DampingDistrib != null && reg.DampingDistrib.length > 0; bool flag2 = reg.ElasticityDistrib != null && reg.ElasticityDistrib.length > 0; bool flag3 = reg.StiffnessDistrib != null && reg.StiffnessDistrib.length > 0; bool flag4 = reg.InertDistrib != null && reg.InertDistrib.length > 0; bool flag5 = reg.RadiusDistrib != null && reg.RadiusDistrib.length > 0; for (int i = 0; i < count; i++) { TempParticleSetup tempParticleSetup = _setupScratch[i]; float num3 = reg.Damping; float num4 = reg.Elasticity; float num5 = reg.Stiffness; float num6 = reg.Inert; float num7 = reg.Radius; if (boneTotalLength > 0f) { float num8 = tempParticleSetup.BoneLength / boneTotalLength; if (flag) { num3 *= reg.DampingDistrib.Evaluate(num8); } if (flag2) { num4 *= reg.ElasticityDistrib.Evaluate(num8); } if (flag3) { num5 *= reg.StiffnessDistrib.Evaluate(num8); } if (flag4) { num6 *= reg.InertDistrib.Evaluate(num8); } if (flag5) { num7 *= reg.RadiusDistrib.Evaluate(num8); } } num3 = Mathf.Clamp01(num3); num4 = Mathf.Clamp01(num4); num5 = Mathf.Clamp01(num5); num6 = Mathf.Clamp01(num6); num7 = Mathf.Max(num7, 0f); int num9 = length2 + i; int transformIndex = -1; if ((Object)(object)tempParticleSetup.Transform != (Object)null) { transformIndex = ((TransformAccessArray)(ref _particleTransforms)).length; ((TransformAccessArray)(ref _particleTransforms)).Add(tempParticleSetup.Transform); _transformToParticle.Add(ref num9); } ref NativeList<ParticleData> particles = ref _particles; ParticleData particleData = new ParticleData { BoneIndex = length, ParentLocalIndex = tempParticleSetup.ParentLocalIndex, TransformIndex = transformIndex, ChildCount = tempParticleSetup.ChildCount, Damping = num3, Elasticity = num4, Stiffness = num5, Inert = num6, Radius = num7, BoneLength = tempParticleSetup.BoneLength, Position = float3.op_Implicit(tempParticleSetup.Position), PrevPosition = float3.op_Implicit(tempParticleSetup.Position), EndOffset = float3.op_Implicit(tempParticleSetup.EndOffset), InitLocalPosition = float3.op_Implicit(tempParticleSetup.InitLocalPosition), InitLocalRotation = quaternion.op_Implicit(tempParticleSetup.InitLocalRotation), TempWorldRotation = quaternion.identity }; particles.Add(ref particleData); ref NativeList<ParticleTransformSnapshot> particleSnapshots = ref _particleSnapshots; ParticleTransformSnapshot particleTransformSnapshot = default(ParticleTransformSnapshot); particleSnapshots.Add(ref particleTransformSnapshot); ref NativeList<ParticleOutput> particleOutputs = ref _particleOutputs; ParticleOutput particleOutput = default(ParticleOutput); particleOutputs.Add(ref particleOutput); } int length3 = _boneColliderHandles.Length; int num10 = 0; if (reg.ColliderHandles != null) { int count2 = reg.ColliderHandles.Count; for (int j = 0; j < count2; j++) { int num11 = reg.ColliderHandles[j]; if (num11 >= 0) { _boneColliderHandles.Add(ref num11); num10++; } } } Vector3 val = reg.Root.InverseTransformDirection(reg.Gravity); float objectScale = Mathf.Abs(reg.OwnerTransform.lossyScale.x); ref NativeList<BoneState> bones = ref _bones; BoneState boneState = new BoneState { ParticleStart = length2, ParticleCount = count, ColliderStart = length3, ColliderCount = num10, RefTransformIndex = refTransformIndex, UpdateRate = Mathf.Max(reg.UpdateRate, 0f), Time = 0f, Weight = reg.Weight, DistanceToObject = reg.DistanceToObject, ObjectScale = objectScale, Gravity = float3.op_Implicit(reg.Gravity), LocalGravity = float3.op_Implicit(val), Force = float3.op_Implicit(reg.Force), ObjectMove = float3.zero, ObjectPrevPosition = float3.op_Implicit(reg.OwnerTransform.position), FreezeAxis = (byte)reg.FreezeAxis, DistantDisable = (byte)(reg.DistantDisable ? 1 : 0), DistantDisabled = 0, IsAnimatePhysics = (byte)(reg.IsAnimatePhysics ? 1 : 0), Enabled = (byte)(reg.Enabled ? 1 : 0), NeedsReset = 0, AppliedThisFrame = 0 }; bones.Add(ref boneState); _setupScratch.Clear(); return num; } public void UnregisterDynamicBone(int boneHandle) { if (_disposed || boneHandle < 0 || boneHandle >= _boneHandleToDense.Length) { return; } CompletePendingJobs(); int num = _boneHandleToDense[boneHandle]; if (num < 0) { return; } BoneState boneState = _bones[num]; int particleStart = boneState.ParticleStart; int num2 = particleStart + boneState.ParticleCount; for (int i = particleStart; i < num2; i++) { ParticleData particleData = _particles[i]; int transformIndex = particleData.TransformIndex; if (transformIndex >= 0) { ((TransformAccessArray)(ref _particleTransforms)).RemoveAtSwapBack(transformIndex); _transformToParticle.RemoveAtSwapBack(transformIndex); if (transformIndex < _transformToParticle.Length) { int num3 = _transformToParticle[transformIndex]; ParticleData particleData2 = _particles[num3]; particleData2.TransformIndex = transformIndex; _particles[num3] = particleData2; } particleData.TransformIndex = -1; particleData.BoneIndex = -1; _particles[i] = particleData; } } _deadParticleCount += boneState.ParticleCount; _deadColliderRefCount += boneState.ColliderCount; if (boneState.RefTransformIndex >= 0) { int refTransformIndex = boneState.RefTransformIndex; ((TransformAccessArray)(ref _refTransforms)).RemoveAtSwapBack(refTransformIndex); _refSnapshots.RemoveAtSwapBack(refTransformIndex); _refDenseToBoneHandle.RemoveAtSwapBack(refTransformIndex); if (refTransformIndex < _refDenseToBoneHandle.Length) { int num4 = _refDenseToBoneHandle[refTransformIndex]; int num5 = _boneHandleToDense[num4]; if (num5 >= 0) { BoneState boneState2 = _bones[num5]; boneState2.RefTransformIndex = refTransformIndex; _bones[num5] = boneState2; } } } _boneHandleToDense[boneHandle] = -1; _freeBoneHandles.Push(boneHandle); _bones.RemoveAtSwapBack(num); _boneDenseToHandle.RemoveAtSwapBack(num); ((TransformAccessArray)(ref _ownerTransforms)).RemoveAtSwapBack(num); _ownerSnapshots.RemoveAtSwapBack(num); if (num < _bones.Length) { int num6 = _boneDenseToHandle[num]; _boneHandleToDense[num6] = num; BoneState boneState3 = _bones[num]; int particleStart2 = boneState3.ParticleStart; int num7 = particleStart2 + boneState3.ParticleCount; for (int j = particleStart2; j < num7; j++) { ParticleData particleData3 = _particles[j]; particleData3.BoneIndex = num; _particles[j] = particleData3; } } } public void SetBoneEnabled(int boneHandle, bool enabled) { if (!_disposed && TryGetDenseBoneIndex(boneHandle, out var denseIdx)) { CompletePendingJobs(); BoneState boneState = _bones[denseIdx]; boneState.Enabled = (byte)(enabled ? 1 : 0); _bones[denseIdx] = boneState; } } public void SetBoneWeight(int boneHandle, float weight) { if (_disposed || !TryGetDenseBoneIndex(boneHandle, out var denseIdx)) { return; } CompletePendingJobs(); BoneState boneState = _bones[denseIdx]; if (boneState.Weight != weight) { float weight2 = boneState.Weight; boneState.Weight = weight; _bones[denseIdx] = boneState; if (weight == 0f) { InitBoneTransformsImmediateInternal(denseIdx); } else if (weight2 == 0f) { ResetBoneParticlesImmediateInternal(denseIdx); } } } public float GetBoneWeight(int boneHandle) { if (_disposed || !TryGetDenseBoneIndex(boneHandle, out var denseIdx)) { return 0f; } CompletePendingJobs(); return _bones[denseIdx].Weight; } public void SyncBoneDynamicParams(int boneHandle, Vector3 gravity, Vector3 force, float updateRate, float distanceToObject, bool distantDisable, BoneFreezeAxis freezeAxis, bool isAnimatePhysics, IList<int> colliderHandles = null) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (_disposed || !TryGetDenseBoneIndex(boneHandle, out var denseIdx)) { return; } CompletePendingJobs(); BoneState boneState = _bones[denseIdx]; boneState.Gravity = float3.op_Implicit(gravity); boneState.Force = float3.op_Implicit(force); boneState.UpdateRate = Mathf.Max(updateRate, 0f); boneState.DistanceToObject = distanceToObject; boneState.DistantDisable = (byte)(distantDisable ? 1 : 0); boneState.FreezeAxis = (byte)freezeAxis; boneState.IsAnimatePhysics = (byte)(isAnimatePhysics ? 1 : 0); if (colliderHandles != null) { _deadColliderRefCount += boneState.ColliderCount; int length = _boneColliderHandles.Length; int num = 0; for (int i = 0; i < colliderHandles.Count; i++) { int num2 = colliderHandles[i]; if (num2 >= 0) { _boneColliderHandles.Add(ref num2); num++; } } boneState.ColliderStart = length; boneState.ColliderCount = num; } _bones[denseIdx] = boneState; } public void ResetBoneParticles(int boneHandle, bool immediate = false) { if (!_disposed && TryGetDenseBoneIndex(boneHandle, out var denseIdx)) { CompletePendingJobs(); if (immediate) { ResetBoneParticlesImmediateInternal(denseIdx); return; } BoneState boneState = _bones[denseIdx]; boneState.NeedsReset = 1; _bones[denseIdx] = boneState; } } public void InitBoneTransformsImmediate(int boneHandle) { if (!_disposed && TryGetDenseBoneIndex(boneHandle, out var denseIdx)) { CompletePendingJobs(); InitBoneTransformsImmediateInternal(denseIdx); } } public JobHandle SchedulePreUpdate(bool animatePhysics) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due t
plugins/DynamicBoneBurstPlugin.dll
Decompiled a day agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using DynamicBoneBurst.BepInExExample; using Microsoft.CodeAnalysis; using On; using Unity.Burst; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("DynamicBoneBurstPlugin")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DynamicBoneBurstPlugin")] [assembly: AssemblyTitle("DynamicBoneBurstPlugin")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace DynamicBoneBurstPlugin { [Serializable] [BepInPlugin("com.weedeater.dynamicboneburst", "Dynamic Bone Burst", "1.0.1")] public class DynamicBoneBurstPluginPlugin : BaseUnityPlugin { public const string guid = "com.weedeater.dynamicboneburst"; public const string name = "Dynamic Bone Burst"; public const string version = "1.0.1"; public static DynamicBoneBurstPluginPlugin instance { get; private set; } public void Awake() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown instance = this; if (BurstRuntime.LoadAdditionalLibrary(Path.Combine(Path.GetDirectoryName(typeof(DynamicBoneBurstPluginPlugin).Assembly.Location), "DynamicBoneBurstBurst.dll"))) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Dynamic Bone Burst: Burst Assembly has been successfully loaded"); } else { ((BaseUnityPlugin)this).Logger.LogError((object)"Dynamic Bone Burst: Couldn't manage to load Burst Assembly"); } DynamicBoneJobDriver.EnsureCreated(); DynamicBone.SetupParticles += new hook_SetupParticles(DynamicBone_SetupParticles); DynamicBone.Update += new hook_Update(DynamicBone_Update); DynamicBone.FixedUpdate += new hook_FixedUpdate(DynamicBone_FixedUpdate); DynamicBone.LateUpdate += new hook_LateUpdate(DynamicBone_LateUpdate); DynamicBone.OnEnable += new hook_OnEnable(DynamicBone_OnEnable); DynamicBone.OnDisable += new hook_OnDisable(DynamicBone_OnDisable); DynamicBone.SetWeight += new hook_SetWeight(DynamicBone_SetWeight); DynamicBone.GetWeight += new hook_GetWeight(DynamicBone_GetWeight); } private float DynamicBone_GetWeight(orig_GetWeight orig, DynamicBone self) { if (Object.op_Implicit((Object)(object)DynamicBoneJobDriver.Instance)) { float result = default(float); if (DynamicBoneJobDriver.Instance.TryGetDynamicBoneWeight(self, ref result)) { return result; } return orig.Invoke(self); } return orig.Invoke(self); } private void DynamicBone_SetWeight(orig_SetWeight orig, DynamicBone self, float w) { if (Object.op_Implicit((Object)(object)DynamicBoneJobDriver.Instance)) { DynamicBoneJobDriver.Instance.OnDynamicBoneSetWeight(self, w); } else { orig.Invoke(self, w); } } private void DynamicBone_OnDisable(orig_OnDisable orig, DynamicBone self) { if (Object.op_Implicit((Object)(object)DynamicBoneJobDriver.Instance)) { DynamicBoneJobDriver.Instance.OnDynamicBoneDisable(self); } } private void DynamicBone_OnEnable(orig_OnEnable orig, DynamicBone self) { if (Object.op_Implicit((Object)(object)DynamicBoneJobDriver.Instance)) { DynamicBoneJobDriver.Instance.OnDynamicBoneEnable(self); } } private void DynamicBone_LateUpdate(orig_LateUpdate orig, DynamicBone self) { } private void DynamicBone_FixedUpdate(orig_FixedUpdate orig, DynamicBone self) { } private void DynamicBone_Update(orig_Update orig, DynamicBone self) { } private void DynamicBone_SetupParticles(orig_SetupParticles orig, DynamicBone self) { DynamicBoneJobDriver.EnsureCreated().OnDynamicBoneStart(self); } } }