using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using FieldInjector;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;
using WeatherElectric.SecondaryMotion;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("A secondary motion system for BONELAB.")]
[assembly: AssemblyDescription("A secondary motion system for BONELAB.")]
[assembly: AssemblyCompany("Weather Electric")]
[assembly: AssemblyProduct("SecondaryMotion")]
[assembly: AssemblyCopyright("Developed by Mabel Amber")]
[assembly: AssemblyTrademark("Weather Electric")]
[assembly: AssemblyFileVersion("1.0.1")]
[assembly: MelonInfo(typeof(Main), "SecondaryMotion", "1.0.1", "Mabel Amber", "https://thunderstore.io/c/bonelab/p/WeatherElectric/SecondaryMotion/")]
[assembly: MelonColor(255, 255, 255, 255)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("1.0.1.0")]
[module: RefSafetyRules(11)]
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 WeatherElectric.SecondaryMotion
{
public class Main : MelonMod
{
internal const string Name = "SecondaryMotion";
internal const string Description = "A secondary motion system for BONELAB.";
internal const string Author = "Mabel Amber";
internal const string Company = "Weather Electric";
internal const string Version = "1.0.1";
internal const string DownloadLink = "https://thunderstore.io/c/bonelab/p/WeatherElectric/SecondaryMotion/";
public override void OnInitializeMelon()
{
SerialisationHandler.Inject<SecondaryMotionCollider>(0);
SerialisationHandler.Inject<SecondaryMotion>(0);
}
}
public enum ColliderBounds
{
Outside,
Inside
}
public enum ColliderDirection
{
X,
Y,
Z
}
public enum ColliderType
{
Sphere,
Capsule
}
public class SecondaryMotion : MonoBehaviour
{
public Transform root;
public List<Transform> exclusions;
public float endLength;
public Vector3 endOffset = Vector3.zero;
public float updateRate = 60f;
public UpdateMode updateMode;
public float blendWeight = 1f;
public float dampening = 0.1f;
public AnimationCurve dampeningCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 1f),
new Keyframe(1f, 1f)
});
public float elasticity = 0.1f;
public AnimationCurve elasticityCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 1f),
new Keyframe(1f, 1f)
});
public float stiffness = 0.1f;
public AnimationCurve stiffnessCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 1f),
new Keyframe(1f, 1f)
});
public float inertia;
public AnimationCurve inertiaCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 1f),
new Keyframe(1f, 1f)
});
public float friction;
public AnimationCurve frictionCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 1f),
new Keyframe(1f, 1f)
});
public Vector3 gravity = Vector3.zero;
public Vector3 force = Vector3.zero;
public float collisionRadius;
public AnimationCurve collisionRadiusCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 1f),
new Keyframe(1f, 1f)
});
public List<SecondaryMotionCollider> colliders;
private Vector3 _objectMove;
private Vector3 _objectPrevPos;
private float _objectScale;
private float _weight = 1f;
private readonly List<SecondaryMotionParticleTree> _particleTrees = new List<SecondaryMotionParticleTree>();
private List<SecondaryMotionCollider> _effectiveCols;
private float _deltaTime;
private float _time;
private int _preUpdCnt;
private static int _updCnt;
private static int _prepFrame;
private void Start()
{
ParticleSetup();
Assembly dynamicBonesAssembly = SecondaryMotionHelpers.GetDynamicBonesAssembly();
if (dynamicBonesAssembly == null)
{
return;
}
Type type = dynamicBonesAssembly.GetType("DynamicBone");
if (type == null)
{
return;
}
foreach (Component item in (Il2CppArrayBase<Component>)(object)((Component)this).GetComponents(Il2CppType.From(type)))
{
Object.Destroy((Object)(object)item);
}
}
private void FixedUpdate()
{
if (updateMode == UpdateMode.FixedUpdate)
{
SimUpdate();
}
}
private void Update()
{
if (updateMode != UpdateMode.FixedUpdate)
{
SimUpdate();
}
_updCnt++;
}
private void LateUpdate()
{
if (_preUpdCnt != 0)
{
if (_updCnt > 0)
{
_updCnt = 0;
_prepFrame++;
}
SetWeight(blendWeight);
if (UpdateNeeded())
{
Prepare();
UpdateParticles();
ApplyParticles();
}
_preUpdCnt = 0;
}
}
private void Prepare()
{
//IL_003b: 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_005c: 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_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_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)
//IL_00a7: 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_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_00fc: 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)
_deltaTime = updateMode switch
{
UpdateMode.UnscaledTime => Time.unscaledDeltaTime,
UpdateMode.FixedUpdate => Time.fixedDeltaTime * (float)_preUpdCnt,
_ => Time.deltaTime,
};
_objectScale = Mathf.Abs(((Component)this).transform.lossyScale.x);
_objectMove = ((Component)this).transform.position - _objectPrevPos;
_objectPrevPos = ((Component)this).transform.position;
foreach (SecondaryMotionParticleTree particleTree in _particleTrees)
{
particleTree.RestGravity = particleTree.Root.TransformDirection(particleTree.LocalGravity);
foreach (SecondaryMotionParticle particle in particleTree.Particles)
{
if (particle.TransformIsntNull)
{
particle.TransformPos = particle.Transform.position;
particle.TransformLocalPos = particle.Transform.localPosition;
particle.TransformLocalToWorld = particle.Transform.localToWorldMatrix;
}
}
}
_effectiveCols?.Clear();
if (colliders == null)
{
return;
}
foreach (SecondaryMotionCollider collider in colliders)
{
if (Object.op_Implicit((Object)(object)collider) && ((Behaviour)collider).enabled)
{
if (_effectiveCols == null)
{
_effectiveCols = new List<SecondaryMotionCollider>();
}
_effectiveCols.Add(collider);
if (collider.PrepareFrame != _prepFrame)
{
collider.Prepare();
collider.PrepareFrame = _prepFrame;
}
}
}
}
private bool UpdateNeeded()
{
return _weight > 0f;
}
private void SimUpdate()
{
if (UpdateNeeded())
{
InitTransforms();
}
_preUpdCnt++;
}
private void OnEnable()
{
ResetParticlesPosition();
}
private void OnDisable()
{
InitTransforms();
}
private void OnDidApplyAnimationProperties()
{
UpdateParams();
}
public void SetWeight(float w)
{
if (!Mathf.Approximately(_weight, w))
{
if (w == 0f)
{
InitTransforms();
}
else if (_weight == 0f)
{
ResetParticlesPosition();
}
_weight = (blendWeight = w);
}
}
public void ParticleSetup()
{
//IL_002c: 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_004c: 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)
_particleTrees.Clear();
if ((Object)(object)root != (Object)null)
{
BuildParticleTree(root);
}
_objectScale = Mathf.Abs(((Component)this).transform.lossyScale.x);
_objectPrevPos = ((Component)this).transform.position;
_objectMove = Vector3.zero;
foreach (SecondaryMotionParticleTree particleTree in _particleTrees)
{
CreateParticles(particleTree, particleTree.Root, -1, 0f);
}
UpdateParams();
}
private void BuildParticleTree(Transform rootTransform)
{
//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)
if (!((Object)(object)rootTransform == (Object)null))
{
SecondaryMotionParticleTree item = new SecondaryMotionParticleTree
{
Root = rootTransform,
RootWorldToLocalMatrix = rootTransform.worldToLocalMatrix
};
_particleTrees.Add(item);
}
}
[HideFromIl2Cpp]
private void CreateParticles(SecondaryMotionParticleTree particleTree, Transform bone, int parentIndex, float boneLength)
{
//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_0033: 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)
//IL_003a: 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_0046: 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_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_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: 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_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: 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_0090: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
while (true)
{
SecondaryMotionParticle secondaryMotionParticle = new SecondaryMotionParticle
{
Transform = bone,
TransformIsntNull = ((Object)(object)bone != (Object)null),
ParentIndex = parentIndex
};
Vector3 val;
if ((Object)(object)bone != (Object)null)
{
val = (secondaryMotionParticle.Position = (secondaryMotionParticle.PrevPos = bone.position));
secondaryMotionParticle.InitLocalPos = bone.localPosition;
secondaryMotionParticle.InitLocalRot = bone.localRotation;
}
else
{
Transform transform = particleTree.Particles[parentIndex].Transform;
if (endLength > 0f)
{
Transform parent = transform.parent;
if ((Object)(object)parent != (Object)null)
{
secondaryMotionParticle.EndOffset = transform.InverseTransformPoint(transform.position * 2f - parent.position) * endLength;
}
else
{
secondaryMotionParticle.EndOffset = new Vector3(endLength, 0f, 0f);
}
}
else
{
secondaryMotionParticle.EndOffset = transform.InverseTransformPoint(((Component)this).transform.TransformDirection(endOffset) + transform.position);
}
val = (secondaryMotionParticle.Position = (secondaryMotionParticle.PrevPos = transform.TransformPoint(secondaryMotionParticle.EndOffset)));
secondaryMotionParticle.InitLocalPos = Vector3.zero;
secondaryMotionParticle.InitLocalRot = Quaternion.identity;
}
if (parentIndex >= 0)
{
float num = boneLength;
val = particleTree.Particles[parentIndex].Transform.position - secondaryMotionParticle.Position;
boneLength = num + ((Vector3)(ref val)).magnitude;
secondaryMotionParticle.BoneLength = boneLength;
particleTree.BoneTotalLength = Mathf.Max(particleTree.BoneTotalLength, boneLength);
particleTree.Particles[parentIndex].ChildCount++;
}
int count = particleTree.Particles.Count;
particleTree.Particles.Add(secondaryMotionParticle);
if ((Object)(object)bone == (Object)null)
{
break;
}
for (int i = 0; i < bone.childCount; i++)
{
Transform child = bone.GetChild(i);
bool flag = false;
if (exclusions != null)
{
flag = exclusions.Contains(child);
}
if (!flag)
{
CreateParticles(particleTree, child, count, boneLength);
}
else if (endLength > 0f || endOffset != Vector3.zero)
{
CreateParticles(particleTree, null, count, boneLength);
}
}
if (bone.childCount == 0 && (endLength > 0f || endOffset != Vector3.zero))
{
bone = null;
parentIndex = count;
continue;
}
break;
}
}
public void UpdateParams()
{
//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_0037: 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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
SetWeight(blendWeight);
foreach (SecondaryMotionParticleTree particleTree in _particleTrees)
{
Vector3 val = ((Matrix4x4)(ref particleTree.RootWorldToLocalMatrix)).MultiplyVector(gravity);
particleTree.LocalGravity = ((Vector3)(ref val)).normalized * ((Vector3)(ref gravity)).magnitude;
foreach (SecondaryMotionParticle particle in particleTree.Particles)
{
particle.Dampening = dampening;
particle.Elasticity = elasticity;
particle.Stiffness = stiffness;
particle.Inertia = inertia;
particle.Friction = friction;
particle.CollisionRadius = collisionRadius;
if (particleTree.BoneTotalLength > 0f)
{
float num = particle.BoneLength / particleTree.BoneTotalLength;
if (dampeningCurve != null && ((Il2CppArrayBase<Keyframe>)(object)dampeningCurve.keys).Length > 0)
{
particle.Dampening *= dampeningCurve.Evaluate(num);
}
if (elasticityCurve != null && ((Il2CppArrayBase<Keyframe>)(object)elasticityCurve.keys).Length > 0)
{
particle.Elasticity *= elasticityCurve.Evaluate(num);
}
if (stiffnessCurve != null && ((Il2CppArrayBase<Keyframe>)(object)stiffnessCurve.keys).Length > 0)
{
particle.Stiffness *= stiffnessCurve.Evaluate(num);
}
if (inertiaCurve != null && ((Il2CppArrayBase<Keyframe>)(object)inertiaCurve.keys).Length > 0)
{
particle.Inertia *= inertiaCurve.Evaluate(num);
}
if (frictionCurve != null && ((Il2CppArrayBase<Keyframe>)(object)frictionCurve.keys).Length > 0)
{
particle.Friction *= frictionCurve.Evaluate(num);
}
if (collisionRadiusCurve != null && ((Il2CppArrayBase<Keyframe>)(object)collisionRadiusCurve.keys).Length > 0)
{
particle.CollisionRadius *= collisionRadiusCurve.Evaluate(num);
}
}
particle.Dampening = Mathf.Clamp01(particle.Dampening);
particle.Elasticity = Mathf.Clamp01(particle.Elasticity);
particle.Stiffness = Mathf.Clamp01(particle.Stiffness);
particle.Inertia = Mathf.Clamp01(particle.Inertia);
particle.Friction = Mathf.Clamp01(particle.Friction);
particle.CollisionRadius = Mathf.Max(particle.CollisionRadius, 0f);
}
}
}
private void InitTransforms()
{
foreach (SecondaryMotionParticleTree particleTree in _particleTrees)
{
SecondaryMotionHelpers.SetTransforms(particleTree);
}
}
private void UpdateParticles()
{
if (_particleTrees.Count <= 0)
{
return;
}
int num = 1;
float timeVar = 1f;
float deltaTime = _deltaTime;
if (updateMode == UpdateMode.Normal)
{
if (updateRate > 0f)
{
timeVar = deltaTime * updateRate;
}
}
else if (updateRate > 0f)
{
float num2 = 1f / updateRate;
_time += deltaTime;
num = 0;
while (_time >= num2)
{
_time -= num2;
if (++num >= 3)
{
_time = 0f;
break;
}
}
}
if (num > 0)
{
for (int i = 0; i < num; i++)
{
UpdateParticlesLoop(timeVar, i);
UpdateParticlesLoop(timeVar);
}
}
else
{
SkipParticleUpdate();
}
}
private void UpdateParticlesLoop(float timeVar, int loopIndex)
{
//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_0026: 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_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: 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_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_004a: 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_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_0053: 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_006c: 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_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: 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_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_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: 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_00ba: 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_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_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_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: 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_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: 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_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: 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)
foreach (SecondaryMotionParticleTree particleTree in _particleTrees)
{
Vector3 val = gravity;
Vector3 normalized = ((Vector3)(ref gravity)).normalized;
Vector3 val2 = normalized * Mathf.Max(Vector3.Dot(particleTree.RestGravity, normalized), 0f);
val -= val2;
val = (val + force) * (_objectScale * timeVar);
Vector3 val3 = ((loopIndex == 0) ? _objectMove : Vector3.zero);
foreach (SecondaryMotionParticle particle in particleTree.Particles)
{
if (particle.ParentIndex >= 0)
{
Vector3 val4 = particle.Position - particle.PrevPos;
Vector3 val5 = val3 * particle.Inertia;
particle.PrevPos = particle.Position + val5;
float num = particle.Dampening;
if (particle.IsCollider)
{
num += particle.Friction;
if (num > 1f)
{
num = 1f;
}
particle.IsCollider = false;
}
particle.Position += val4 * (1f - num) + val + val5;
}
else
{
particle.PrevPos = particle.Position;
particle.Position = particle.TransformPos;
}
}
}
}
private void UpdateParticlesLoop(float timeVar)
{
//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_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_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: 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_00e3: 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_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_00ef: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: 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_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: 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_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: 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_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_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: 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_0174: 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)
foreach (SecondaryMotionParticleTree particleTree in _particleTrees)
{
for (int i = 1; i < particleTree.Particles.Count; i++)
{
SecondaryMotionParticle secondaryMotionParticle = particleTree.Particles[i];
SecondaryMotionParticle secondaryMotionParticle2 = particleTree.Particles[secondaryMotionParticle.ParentIndex];
Vector3 val;
float magnitude;
if (!secondaryMotionParticle.TransformIsntNull)
{
val = ((Matrix4x4)(ref secondaryMotionParticle2.TransformLocalToWorld)).MultiplyVector(secondaryMotionParticle.EndOffset);
magnitude = ((Vector3)(ref val)).magnitude;
}
else
{
val = secondaryMotionParticle2.TransformPos - secondaryMotionParticle.TransformPos;
magnitude = ((Vector3)(ref val)).magnitude;
}
float num = magnitude;
float num2 = Mathf.Lerp(1f, secondaryMotionParticle.Stiffness, _weight);
if (num2 > 0f || secondaryMotionParticle.Elasticity > 0f)
{
Matrix4x4 transformLocalToWorld = secondaryMotionParticle2.TransformLocalToWorld;
((Matrix4x4)(ref transformLocalToWorld)).SetColumn(3, Vector4.op_Implicit(secondaryMotionParticle2.Position));
Vector3 val2 = ((Matrix4x4)(ref transformLocalToWorld)).MultiplyPoint3x4(secondaryMotionParticle.TransformIsntNull ? secondaryMotionParticle.TransformLocalPos : secondaryMotionParticle.EndOffset);
Vector3 val3 = val2 - secondaryMotionParticle.Position;
secondaryMotionParticle.Position += val3 * (secondaryMotionParticle.Elasticity * timeVar);
if (num2 > 0f)
{
val3 = val2 - secondaryMotionParticle.Position;
float magnitude2 = ((Vector3)(ref val3)).magnitude;
float num3 = num * (1f + (1f - num2) * 2f);
if (magnitude2 > num3)
{
secondaryMotionParticle.Position += val3 * ((magnitude2 - num3) / magnitude2);
}
}
}
if (_effectiveCols != null)
{
float particleRadius = secondaryMotionParticle.CollisionRadius * _objectScale;
foreach (SecondaryMotionCollider effectiveCol in _effectiveCols)
{
secondaryMotionParticle.IsCollider |= effectiveCol.Collide(ref secondaryMotionParticle.Position, particleRadius);
}
}
Vector3 val4 = secondaryMotionParticle2.Position - secondaryMotionParticle.Position;
float magnitude3 = ((Vector3)(ref val4)).magnitude;
if (magnitude3 > 0f)
{
secondaryMotionParticle.Position += val4 * ((magnitude3 - num) / magnitude3);
}
}
}
}
private void SkipParticleUpdate()
{
//IL_005a: 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_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_0071: 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_0081: 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_0042: 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_00bb: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: 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_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: 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_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: 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_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: 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_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: 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)
foreach (SecondaryMotionParticleTree particleTree in _particleTrees)
{
List<SecondaryMotionParticle> particles = particleTree.Particles;
foreach (SecondaryMotionParticle item in particles)
{
if (item.ParentIndex < 0)
{
item.PrevPos = item.Position;
item.Position = item.TransformPos;
continue;
}
item.PrevPos += _objectMove;
item.Position += _objectMove;
SecondaryMotionParticle secondaryMotionParticle = particles[item.ParentIndex];
float num;
if (!item.TransformIsntNull)
{
Vector3 val = ((Matrix4x4)(ref secondaryMotionParticle.TransformLocalToWorld)).MultiplyVector(item.EndOffset);
num = ((Vector3)(ref val)).magnitude;
}
else
{
num = Vector3.Distance(secondaryMotionParticle.TransformPos, item.TransformPos);
}
float num2 = num;
if (Mathf.Lerp(1f, item.Stiffness, _weight) > 0f)
{
Matrix4x4 transformLocalToWorld = secondaryMotionParticle.TransformLocalToWorld;
((Matrix4x4)(ref transformLocalToWorld)).SetColumn(3, Vector4.op_Implicit(secondaryMotionParticle.Position));
Vector3 val2 = ((Matrix4x4)(ref transformLocalToWorld)).MultiplyPoint3x4(item.TransformIsntNull ? item.TransformLocalPos : item.EndOffset) - item.Position;
float magnitude = ((Vector3)(ref val2)).magnitude;
float num3 = num2 * (1f + (1f - stiffness) * 2f);
if (magnitude > num3)
{
item.Position += val2 / magnitude * (magnitude - num3);
}
}
Vector3 val3 = secondaryMotionParticle.Position - item.Position;
float magnitude2 = ((Vector3)(ref val3)).magnitude;
if (magnitude2 > 0f)
{
item.Position += val3 / magnitude2 * (magnitude2 - num2);
}
}
}
}
private void ResetParticlesPosition()
{
//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)
foreach (SecondaryMotionParticleTree particleTree in _particleTrees)
{
SecondaryMotionHelpers.ResetParticlePos(particleTree);
}
_objectPrevPos = ((Component)this).transform.position;
}
private void ApplyParticles()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: 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_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: 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_0025: 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_0035: 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_0043: 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_0073: 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_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: 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_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: 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_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: 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_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: 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_0174: 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_017a: 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_018c: 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_019a: 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_0180: 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_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)
Vector3 right = Vector3.right;
Vector3 up = Vector3.up;
Vector3 forward = Vector3.forward;
bool flag = false;
bool flag2 = false;
bool flag3 = false;
Vector3 lossyScale = ((Component)this).transform.lossyScale;
if (lossyScale.x < 0f || lossyScale.y < 0f || lossyScale.z < 0f)
{
Transform val = ((Component)this).transform;
do
{
Vector3 localScale = val.localScale;
flag = localScale.x < 0f;
if (flag)
{
right = val.right;
}
flag2 = localScale.y < 0f;
if (flag2)
{
up = val.up;
}
flag3 = localScale.z < 0f;
if (flag3)
{
forward = val.forward;
}
if (flag || flag2 || flag3)
{
break;
}
val = val.parent;
}
while (Object.op_Implicit((Object)(object)val));
}
foreach (SecondaryMotionParticleTree particleTree in _particleTrees)
{
for (int i = 1; i < particleTree.Particles.Count; i++)
{
SecondaryMotionParticle secondaryMotionParticle = particleTree.Particles[i];
SecondaryMotionParticle secondaryMotionParticle2 = particleTree.Particles[secondaryMotionParticle.ParentIndex];
if (secondaryMotionParticle2.ChildCount <= 1)
{
Vector3 val2 = (secondaryMotionParticle.TransformIsntNull ? secondaryMotionParticle.Transform.localPosition : secondaryMotionParticle.EndOffset);
Vector3 val3 = secondaryMotionParticle2.Transform.TransformDirection(val2);
Vector3 val4 = secondaryMotionParticle.Position - secondaryMotionParticle2.Position;
if (flag)
{
val4 = SecondaryMotionHelpers.VectorMirror(val4, right);
}
if (flag2)
{
val4 = SecondaryMotionHelpers.VectorMirror(val4, up);
}
if (flag3)
{
val4 = SecondaryMotionHelpers.VectorMirror(val4, forward);
}
Quaternion val5 = Quaternion.FromToRotation(val3, val4);
secondaryMotionParticle2.Transform.rotation = val5 * secondaryMotionParticle2.Transform.rotation;
}
if (secondaryMotionParticle.TransformIsntNull)
{
secondaryMotionParticle.Transform.position = secondaryMotionParticle.Position;
}
}
}
}
public SecondaryMotion(IntPtr ptr)
: base(ptr)
{
}//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_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_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_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: 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)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Expected O, but got Unknown
//IL_00cf: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Expected O, but got Unknown
//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)
//IL_0122: 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_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Expected O, but got Unknown
//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_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: 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_0173: Expected O, but got Unknown
//IL_0174: 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_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: 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_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Expected O, but got Unknown
}
public class SecondaryMotionCollider : MonoBehaviour
{
public ColliderType type;
public ColliderDirection direction = ColliderDirection.Y;
public ColliderBounds bounds;
public Vector3 center = Vector3.zero;
public float radius = 0.5f;
public float height;
public float radius2;
private float _scaledRadius;
private float _scaledRadius2;
private Vector3 _col1;
private Vector3 _col2;
private float _col1Col2Distance;
private int _collideType;
public int PrepareFrame { get; set; }
public void Start()
{
Assembly dynamicBonesAssembly = SecondaryMotionHelpers.GetDynamicBonesAssembly();
if (dynamicBonesAssembly == null)
{
return;
}
Type type = dynamicBonesAssembly.GetType("DynamicBoneColliderBase");
if (type == null)
{
return;
}
foreach (Component item in (Il2CppArrayBase<Component>)(object)((Component)this).GetComponents(Il2CppType.From(type)))
{
Object.Destroy((Object)(object)item);
}
}
public void Prepare()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: 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_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_0073: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: 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_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: 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_01a4: 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_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: 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_0139: 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_0144: 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_0277: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_027e: Unknown result type (might be due to invalid IL or missing references)
//IL_028a: 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_0298: Unknown result type (might be due to invalid IL or missing references)
//IL_029e: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: 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)
float num = Mathf.Abs(((Component)this).transform.lossyScale.x);
float num2 = height * 0.5f;
Vector3 val3;
if (radius2 <= 0f || Mathf.Abs(radius - radius2) < 0.01f)
{
_scaledRadius = radius * num;
float num3 = num2 - radius;
if (num3 <= 0f)
{
_col1 = ((Component)this).transform.TransformPoint(center);
_collideType = ((bounds != ColliderBounds.Outside) ? 1 : 0);
return;
}
Vector3 val = center;
Vector3 val2 = center;
switch (direction)
{
case ColliderDirection.X:
val.x += num3;
val2.x -= num3;
break;
case ColliderDirection.Y:
val.y += num3;
val2.y -= num3;
break;
case ColliderDirection.Z:
val.z += num3;
val2.z -= num3;
break;
default:
throw new ArgumentOutOfRangeException();
}
_col1 = ((Component)this).transform.TransformPoint(val);
_col2 = ((Component)this).transform.TransformPoint(val2);
val3 = _col2 - _col1;
_col1Col2Distance = ((Vector3)(ref val3)).magnitude;
_collideType = ((bounds == ColliderBounds.Outside) ? 2 : 3);
return;
}
float num4 = Mathf.Max(radius, radius2);
if (num2 - num4 <= 0f)
{
_scaledRadius = num4 * num;
_col1 = ((Component)this).transform.TransformPoint(center);
_collideType = ((bounds != ColliderBounds.Outside) ? 1 : 0);
return;
}
_scaledRadius = radius * num;
_scaledRadius2 = radius2 * num;
float num5 = num2 - radius;
float num6 = num2 - radius2;
Vector3 val4 = center;
Vector3 val5 = center;
switch (direction)
{
case ColliderDirection.X:
val4.x += num5;
val5.x -= num6;
break;
case ColliderDirection.Y:
val4.y += num5;
val5.y -= num6;
break;
case ColliderDirection.Z:
val4.z += num5;
val5.z -= num6;
break;
default:
throw new ArgumentOutOfRangeException();
}
_col1 = ((Component)this).transform.TransformPoint(val4);
_col2 = ((Component)this).transform.TransformPoint(val5);
val3 = _col2 - _col1;
_col1Col2Distance = ((Vector3)(ref val3)).magnitude;
_collideType = ((bounds == ColliderBounds.Outside) ? 4 : 5);
}
public bool Collide(ref Vector3 particlePosition, float particleRadius)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_0065: 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_0087: 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_00a9: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
return _collideType switch
{
0 => SecondaryMotionHelpers.CollideOutsideSphere(ref particlePosition, particleRadius, _col1, _scaledRadius),
1 => SecondaryMotionHelpers.CollideInsideSphere(ref particlePosition, particleRadius, _col1, _scaledRadius),
2 => SecondaryMotionHelpers.CollideOutsideCapsule(ref particlePosition, particleRadius, _col1, _col2, _scaledRadius, _col1Col2Distance),
3 => SecondaryMotionHelpers.CollideInsideCapsule(ref particlePosition, particleRadius, _col1, _col2, _scaledRadius, _col1Col2Distance),
4 => SecondaryMotionHelpers.CollideOutsideCapsule2(ref particlePosition, particleRadius, _col1, _col2, _scaledRadius, _scaledRadius2, _col1Col2Distance),
5 => SecondaryMotionHelpers.CollideInsideCapsule2(ref particlePosition, particleRadius, _col1, _col2, _scaledRadius, _scaledRadius2, _col1Col2Distance),
_ => false,
};
}
public SecondaryMotionCollider(IntPtr ptr)
: base(ptr)
{
}//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
}
internal static class SecondaryMotionHelpers
{
private static Assembly _dynamicBones;
public static bool CollideOutsideSphere(ref Vector3 particlePosition, float particleRadius, Vector3 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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: 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)
float num = sphereRadius + particleRadius;
float num2 = num * num;
Vector3 val = particlePosition - sphereCenter;
float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
if (!(sqrMagnitude > 0f) || !(sqrMagnitude < num2))
{
return false;
}
float num3 = Mathf.Sqrt(sqrMagnitude);
particlePosition = sphereCenter + val * (num / num3);
return true;
}
public static bool CollideInsideSphere(ref Vector3 particlePosition, float particleRadius, Vector3 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_002c: 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_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)
float num = sphereRadius - particleRadius;
float num2 = num * num;
Vector3 val = particlePosition - sphereCenter;
float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
if (!(sqrMagnitude > num2))
{
return false;
}
float num3 = Mathf.Sqrt(sqrMagnitude);
particlePosition = sphereCenter + val * (num / num3);
return true;
}
public static bool CollideOutsideCapsule(ref Vector3 particlePosition, float particleRadius, Vector3 capsuleP0, Vector3 capsuleP1, float capsuleRadius, float dirlen)
{
//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_00be: 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_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_00cf: 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_007d: 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_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_0059: 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_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_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: 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_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_00b7: Unknown result type (might be due to invalid IL or missing references)
float num = capsuleRadius + particleRadius;
float num2 = num * num;
Vector3 val = capsuleP1 - capsuleP0;
Vector3 val2 = particlePosition - capsuleP0;
float num3 = Vector3.Dot(val2, val);
if (num3 <= 0f)
{
float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
if (!(sqrMagnitude > 0f) || !(sqrMagnitude < num2))
{
return false;
}
float num4 = Mathf.Sqrt(sqrMagnitude);
particlePosition = capsuleP0 + val2 * (num / num4);
return true;
}
float num5 = dirlen * dirlen;
if (num3 >= num5)
{
val2 = particlePosition - capsuleP1;
float sqrMagnitude2 = ((Vector3)(ref val2)).sqrMagnitude;
if (!(sqrMagnitude2 > 0f) || !(sqrMagnitude2 < num2))
{
return false;
}
float num6 = Mathf.Sqrt(sqrMagnitude2);
particlePosition = capsuleP1 + val2 * (num / num6);
return true;
}
Vector3 val3 = val2 - val * (num3 / num5);
float sqrMagnitude3 = ((Vector3)(ref val3)).sqrMagnitude;
if (!(sqrMagnitude3 > 0f) || !(sqrMagnitude3 < num2))
{
return false;
}
float num7 = Mathf.Sqrt(sqrMagnitude3);
particlePosition += val3 * ((num - num7) / num7);
return true;
}
public static bool CollideInsideCapsule(ref Vector3 particlePosition, float particleRadius, Vector3 capsuleP0, Vector3 capsuleP1, float capsuleRadius, float dirlen)
{
//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_00ac: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: 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_004a: 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_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_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: 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_00f2: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
float num = capsuleRadius - particleRadius;
float num2 = num * num;
Vector3 val = capsuleP1 - capsuleP0;
Vector3 val2 = particlePosition - capsuleP0;
float num3 = Vector3.Dot(val2, val);
if (num3 <= 0f)
{
float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
if (!(sqrMagnitude > num2))
{
return false;
}
float num4 = Mathf.Sqrt(sqrMagnitude);
particlePosition = capsuleP0 + val2 * (num / num4);
return true;
}
float num5 = dirlen * dirlen;
if (num3 >= num5)
{
val2 = particlePosition - capsuleP1;
float sqrMagnitude2 = ((Vector3)(ref val2)).sqrMagnitude;
if (!(sqrMagnitude2 > num2))
{
return false;
}
float num6 = Mathf.Sqrt(sqrMagnitude2);
particlePosition = capsuleP1 + val2 * (num / num6);
return true;
}
Vector3 val3 = val2 - val * (num3 / num5);
float sqrMagnitude3 = ((Vector3)(ref val3)).sqrMagnitude;
if (!(sqrMagnitude3 > num2))
{
return false;
}
float num7 = Mathf.Sqrt(sqrMagnitude3);
particlePosition += val3 * ((num - num7) / num7);
return true;
}
public static bool CollideOutsideCapsule2(ref Vector3 particlePosition, float particleRadius, Vector3 capsuleP0, Vector3 capsuleP1, float capsuleRadius0, float capsuleRadius1, float dirlen)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: 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_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_0016: 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_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_00dd: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: 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_008c: 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_0056: 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_005d: 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_0067: 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_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: 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)
Vector3 val = capsuleP1 - capsuleP0;
Vector3 val2 = particlePosition - capsuleP0;
float num = Vector3.Dot(val2, val);
if (num <= 0f)
{
float num2 = capsuleRadius0 + particleRadius;
float num3 = num2 * num2;
float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
if (!(sqrMagnitude > 0f) || !(sqrMagnitude < num3))
{
return false;
}
float num4 = Mathf.Sqrt(sqrMagnitude);
particlePosition = capsuleP0 + val2 * (num2 / num4);
return true;
}
float num5 = dirlen * dirlen;
if (num >= num5)
{
float num6 = capsuleRadius1 + particleRadius;
float num7 = num6 * num6;
val2 = particlePosition - capsuleP1;
float sqrMagnitude2 = ((Vector3)(ref val2)).sqrMagnitude;
if (!(sqrMagnitude2 > 0f) || !(sqrMagnitude2 < num7))
{
return false;
}
float num8 = Mathf.Sqrt(sqrMagnitude2);
particlePosition = capsuleP1 + val2 * (num6 / num8);
}
else
{
Vector3 val3 = val2 - val * (num / num5);
float sqrMagnitude3 = ((Vector3)(ref val3)).sqrMagnitude;
float num9 = Vector3.Dot(val2, val / dirlen);
float num10 = Mathf.Lerp(capsuleRadius0, capsuleRadius1, num9 / dirlen) + particleRadius;
float num11 = num10 * num10;
if (!(sqrMagnitude3 > 0f) || !(sqrMagnitude3 < num11))
{
return false;
}
float num12 = Mathf.Sqrt(sqrMagnitude3);
particlePosition += val3 * ((num10 - num12) / num12);
}
return true;
}
public static bool CollideInsideCapsule2(ref Vector3 particlePosition, float particleRadius, Vector3 capsuleP0, Vector3 capsuleP1, float capsuleRadius0, float capsuleRadius1, float dirlen)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: 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_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_0016: 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_00bd: 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_00d6: 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_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: 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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: 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_004e: 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_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: 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)
Vector3 val = capsuleP1 - capsuleP0;
Vector3 val2 = particlePosition - capsuleP0;
float num = Vector3.Dot(val2, val);
if (num <= 0f)
{
float num2 = capsuleRadius0 - particleRadius;
float num3 = num2 * num2;
float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
if (!(sqrMagnitude > num3))
{
return false;
}
float num4 = Mathf.Sqrt(sqrMagnitude);
particlePosition = capsuleP0 + val2 * (num2 / num4);
return true;
}
float num5 = dirlen * dirlen;
if (num >= num5)
{
float num6 = capsuleRadius1 - particleRadius;
float num7 = num6 * num6;
val2 = particlePosition - capsuleP1;
float sqrMagnitude2 = ((Vector3)(ref val2)).sqrMagnitude;
if (!(sqrMagnitude2 > num7))
{
return false;
}
float num8 = Mathf.Sqrt(sqrMagnitude2);
particlePosition = capsuleP1 + val2 * (num6 / num8);
}
else
{
Vector3 val3 = val2 - val * (num / num5);
float sqrMagnitude3 = ((Vector3)(ref val3)).sqrMagnitude;
float num9 = Vector3.Dot(val2, val / dirlen);
float num10 = Mathf.Lerp(capsuleRadius0, capsuleRadius1, num9 / dirlen) - particleRadius;
float num11 = num10 * num10;
if (!(sqrMagnitude3 > num11))
{
return false;
}
float num12 = Mathf.Sqrt(sqrMagnitude3);
particlePosition += val3 * ((num10 - num12) / num12);
}
return true;
}
public static void ResetParticlePos(SecondaryMotionParticleTree particleTree)
{
//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_005f: 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_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_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: 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_002c: 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_0033: Unknown result type (might be due to invalid IL or missing references)
foreach (SecondaryMotionParticle particle in particleTree.Particles)
{
if (particle.TransformIsntNull)
{
particle.Position = (particle.PrevPos = particle.Transform.position);
}
else
{
Transform transform = particleTree.Particles[particle.ParentIndex].Transform;
particle.Position = (particle.PrevPos = transform.TransformPoint(particle.EndOffset));
}
particle.IsCollider = false;
}
}
public static void SetTransforms(SecondaryMotionParticleTree particleTree)
{
//IL_0025: 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)
foreach (SecondaryMotionParticle particle in particleTree.Particles)
{
if (particle.TransformIsntNull)
{
particle.Transform.localPosition = particle.InitLocalPos;
particle.Transform.localRotation = particle.InitLocalRot;
}
}
}
public static Vector3 VectorMirror(Vector3 vector3, Vector3 axis)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: 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)
return vector3 - axis * (Vector3.Dot(vector3, axis) * 2f);
}
public static Assembly GetDynamicBonesAssembly()
{
if (_dynamicBones != null)
{
return _dynamicBones;
}
_dynamicBones = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => string.Equals(a.GetName().Name, "DynamicBonesBL", StringComparison.OrdinalIgnoreCase));
if (!(_dynamicBones != null))
{
return _dynamicBones;
}
return null;
}
}
public class SecondaryMotionParticle
{
public Transform Transform;
public int ParentIndex;
public int ChildCount;
public float Dampening;
public float Elasticity;
public float Stiffness;
public float Inertia;
public float Friction;
public float CollisionRadius;
public float BoneLength;
public bool IsCollider;
public bool TransformIsntNull;
public Vector3 Position;
public Vector3 PrevPos;
public Vector3 EndOffset;
public Vector3 InitLocalPos;
public Quaternion InitLocalRot;
public Vector3 TransformPos;
public Vector3 TransformLocalPos;
public Matrix4x4 TransformLocalToWorld;
}
public class SecondaryMotionParticleTree
{
public Transform Root;
public Vector3 LocalGravity;
public Matrix4x4 RootWorldToLocalMatrix;
public float BoneTotalLength;
public readonly List<SecondaryMotionParticle> Particles = new List<SecondaryMotionParticle>();
public Vector3 RestGravity;
}
public enum UpdateMode
{
Normal,
FixedUpdate,
UnscaledTime
}
}