// Token: 0x06000012 RID: 18 RVA: 0x00002CC0 File Offset: 0x00000EC0 private void UpdateParticles2() { Plane plane = default(Plane); for (int i = 1; i < this.m_Particles.Count; i++) { DynamicBone.Particle particle = this.m_Particles[i]; DynamicBone.Particle particle2 = this.m_Particles[particle.m_ParentIndex]; bool flag = particle.m_Transform != null; float magnitude; if (flag) { magnitude = (particle2.m_Transform.position - particle.m_Transform.position).magnitude; } else { magnitude = particle2.m_Transform.localToWorldMatrix.MultiplyVector(particle.m_EndOffset).magnitude; } float num = Mathf.Lerp(1f, particle.m_Stiffness, this.m_Weight); bool flag2 = num > 0f || particle.m_Elasticity > 0f; if (flag2) { Matrix4x4 localToWorldMatrix = particle2.m_Transform.localToWorldMatrix; localToWorldMatrix.SetColumn(3, particle2.m_Position); bool flag3 = particle.m_Transform != null; Vector3 vector; if (flag3) { vector = localToWorldMatrix.MultiplyPoint3x4(particle.m_Transform.localPosition); } else { vector = localToWorldMatrix.MultiplyPoint3x4(particle.m_EndOffset); } Vector3 vector2 = vector - particle.m_Position; particle.m_Position += vector2 * particle.m_Elasticity; bool flag4 = num > 0f; if (flag4) { vector2 = vector - particle.m_Position; float magnitude2 = vector2.magnitude; float num2 = magnitude * (1f - num) * 2f; bool flag5 = magnitude2 > num2; if (flag5) { particle.m_Position += vector2 * ((magnitude2 - num2) / magnitude2); } } } bool flag6 = this.m_Colliders != null; if (flag6) { float particleRadius = particle.m_Radius * this.m_ObjectScale; for (int j = 0; j < this.m_Colliders.Count; j++) { DynamicBoneCollider dynamicBoneCollider = this.m_Colliders[j]; bool flag7 = dynamicBoneCollider != null && dynamicBoneCollider.enabled; if (flag7) { dynamicBoneCollider.Collide(ref particle.m_Position, particleRadius); } } } bool flag8 = this.m_FreezeAxis > DynamicBone.FreezeAxis.None; if (flag8) { switch (this.m_FreezeAxis) { case DynamicBone.FreezeAxis.X: plane.SetNormalAndPosition(particle2.m_Transform.right, particle2.m_Position); break; case DynamicBone.FreezeAxis.Y: plane.SetNormalAndPosition(particle2.m_Transform.up, particle2.m_Position); break; case DynamicBone.FreezeAxis.Z: plane.SetNormalAndPosition(particle2.m_Transform.forward, particle2.m_Position); break; } particle.m_Position -= plane.normal * plane.GetDistanceToPoint(particle.m_Position); } Vector3 vector3 = particle2.m_Position - particle.m_Position; float magnitude3 = vector3.magnitude; bool flag9 = magnitude3 > 0f; if (flag9) { particle.m_Position += vector3 * ((magnitude3 - magnitude) / magnitude3); } } }
void UpdateParticles2() { Plane movePlane = new Plane(); for (int i = 1; i < m_Particles.Count; ++i) { Particle p = m_Particles[i]; Particle p0 = m_Particles[p.m_ParentIndex]; float restLen; if (p.m_Transform != null) { restLen = (p0.m_Transform.position - p.m_Transform.position).magnitude; } else { restLen = p0.m_Transform.localToWorldMatrix.MultiplyVector(p.m_EndOffset).magnitude; } // keep shape float stiffness = Mathf.Lerp(1.0f, p.m_Stiffness, m_Weight); if (stiffness > 0 || p.m_Elasticity > 0) { Matrix4x4 m0 = p0.m_Transform.localToWorldMatrix; m0.SetColumn(3, p0.m_Position); Vector3 restPos; if (p.m_Transform != null) { restPos = m0.MultiplyPoint3x4(p.m_Transform.localPosition); } else { restPos = m0.MultiplyPoint3x4(p.m_EndOffset); } Vector3 d = restPos - p.m_Position; p.m_Position += d * p.m_Elasticity; if (stiffness > 0) { d = restPos - p.m_Position; float len = d.magnitude; float maxlen = restLen * (1 - stiffness) * 2; if (len > maxlen) { p.m_Position += d * ((len - maxlen) / len); } } } // collide if (m_Colliders != null) { float particleRadius = p.m_Radius * m_ObjectScale; for (int j = 0; j < m_Colliders.Count; ++j) { DynamicBoneCollider c = m_Colliders[j]; if (c != null && c.enabled) { c.Collide(ref p.m_Position, particleRadius); } } } // freeze axis, project to plane if (m_FreezeAxis != FreezeAxis.None) { switch (m_FreezeAxis) { case FreezeAxis.X: movePlane.SetNormalAndPosition(p0.m_Transform.right, p0.m_Position); break; case FreezeAxis.Y: movePlane.SetNormalAndPosition(p0.m_Transform.up, p0.m_Position); break; case FreezeAxis.Z: movePlane.SetNormalAndPosition(p0.m_Transform.forward, p0.m_Position); break; } p.m_Position -= movePlane.normal * movePlane.GetDistanceToPoint(p.m_Position); } // keep length Vector3 dd = p0.m_Position - p.m_Position; float leng = dd.magnitude; if (leng > 0) { p.m_Position += dd * ((leng - restLen) / leng); } } }
private void UpdateParticles2() { Plane plane = (Plane)null; for (int index1 = 1; index1 < this.m_Particles.Count; ++index1) { DynamicBoneV2.Particle particle1 = this.m_Particles[index1]; DynamicBoneV2.Particle particle2 = this.m_Particles[particle1.m_ParentIndex]; float magnitude1; if (Object.op_Inequality((Object)particle1.m_Transform, (Object)null)) { Vector3 vector3 = Vector3.op_Subtraction(particle2.m_Transform.get_position(), particle1.m_Transform.get_position()); magnitude1 = ((Vector3) ref vector3).get_magnitude(); } else { Matrix4x4 localToWorldMatrix = particle2.m_Transform.get_localToWorldMatrix(); Vector3 vector3 = ((Matrix4x4) ref localToWorldMatrix).MultiplyVector(particle1.m_EndOffset); magnitude1 = ((Vector3) ref vector3).get_magnitude(); } float num1 = Mathf.Lerp(1f, particle1.m_Stiffness, this.m_Weight); if ((double)num1 > 0.0 || (double)particle1.m_Elasticity > 0.0) { Matrix4x4 localToWorldMatrix = particle2.m_Transform.get_localToWorldMatrix(); ((Matrix4x4) ref localToWorldMatrix).SetColumn(3, Vector4.op_Implicit(particle2.m_Position)); Vector3 vector3_1 = !Object.op_Inequality((Object)particle1.m_Transform, (Object)null) ? ((Matrix4x4) ref localToWorldMatrix).MultiplyPoint3x4(particle1.m_EndOffset) : ((Matrix4x4) ref localToWorldMatrix).MultiplyPoint3x4(particle1.m_Transform.get_localPosition()); Vector3 vector3_2 = Vector3.op_Subtraction(vector3_1, particle1.m_Position); DynamicBoneV2.Particle particle3 = particle1; particle3.m_Position = Vector3.op_Addition(particle3.m_Position, Vector3.op_Multiply(vector3_2, particle1.m_Elasticity)); if ((double)num1 > 0.0) { Vector3 vector3_3 = Vector3.op_Subtraction(vector3_1, particle1.m_Position); float magnitude2 = ((Vector3) ref vector3_3).get_magnitude(); float num2 = (float)((double)magnitude1 * (1.0 - (double)num1) * 2.0); if ((double)magnitude2 > (double)num2) { DynamicBoneV2.Particle particle4 = particle1; particle4.m_Position = Vector3.op_Addition(particle4.m_Position, Vector3.op_Multiply(vector3_3, (magnitude2 - num2) / magnitude2)); } } } if (this.m_Colliders != null) { float particleRadius = particle1.m_Radius * this.m_ObjectScale; for (int index2 = 0; index2 < this.m_Colliders.Count; ++index2) { DynamicBoneCollider collider = this.m_Colliders[index2]; if (Object.op_Inequality((Object)collider, (Object)null) && ((Behaviour)collider).get_enabled()) { collider.Collide(ref particle1.m_Position, particleRadius); } } } if (this.m_FreezeAxis != DynamicBoneV2.FreezeAxis.None) { switch (this.m_FreezeAxis) { case DynamicBoneV2.FreezeAxis.X: ((Plane) ref plane).SetNormalAndPosition(particle2.m_Transform.get_right(), particle2.m_Position); break; case DynamicBoneV2.FreezeAxis.Y: ((Plane) ref plane).SetNormalAndPosition(particle2.m_Transform.get_up(), particle2.m_Position); break; case DynamicBoneV2.FreezeAxis.Z: ((Plane) ref plane).SetNormalAndPosition(particle2.m_Transform.get_forward(), particle2.m_Position); break; } DynamicBoneV2.Particle particle3 = particle1; particle3.m_Position = Vector3.op_Subtraction(particle3.m_Position, Vector3.op_Multiply(((Plane) ref plane).get_normal(), ((Plane) ref plane).GetDistanceToPoint(particle1.m_Position))); } Vector3 vector3_4 = Vector3.op_Subtraction(particle2.m_Position, particle1.m_Position); float magnitude3 = ((Vector3) ref vector3_4).get_magnitude(); if ((double)magnitude3 > 0.0) { DynamicBoneV2.Particle particle3 = particle1; particle3.m_Position = Vector3.op_Addition(particle3.m_Position, Vector3.op_Multiply(vector3_4, (magnitude3 - magnitude1) / magnitude3)); } } }
private void UpdateParticles2() { //IL_0002: 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_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_0070: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_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_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) //IL_0106: 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_011a: 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_011f: 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_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_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_0144: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: 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_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: 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_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) Plane val = default(Plane); for (int i = 1; i < m_Particles.Count; i++) { Particle particle = m_Particles[i]; Particle particle2 = m_Particles[particle.m_ParentIndex]; float magnitude; if (particle.m_Transform != null) { Vector3 val2 = particle2.m_Transform.get_position() - particle.m_Transform.get_position(); magnitude = val2.get_magnitude(); } else { Matrix4x4 localToWorldMatrix = particle2.m_Transform.get_localToWorldMatrix(); Vector3 val3 = localToWorldMatrix.MultiplyVector(particle.m_EndOffset); magnitude = val3.get_magnitude(); } float num = Mathf.Lerp(1f, particle.m_Stiffness, m_Weight); if (num > 0f || particle.m_Elasticity > 0f) { Matrix4x4 localToWorldMatrix2 = particle2.m_Transform.get_localToWorldMatrix(); localToWorldMatrix2.SetColumn(3, Vector4.op_Implicit(particle2.m_Position)); Vector3 val4 = (!(particle.m_Transform != null)) ? localToWorldMatrix2.MultiplyPoint3x4(particle.m_EndOffset) : localToWorldMatrix2.MultiplyPoint3x4(particle.m_Transform.get_localPosition()); Vector3 val5 = val4 - particle.m_Position; Particle particle3 = particle; particle3.m_Position += val5 * particle.m_Elasticity; if (num > 0f) { val5 = val4 - particle.m_Position; float magnitude2 = val5.get_magnitude(); float num2 = magnitude * (1f - num) * 2f; if (magnitude2 > num2) { Particle particle4 = particle; particle4.m_Position += val5 * ((magnitude2 - num2) / magnitude2); } } } if (m_Colliders != null) { float particleRadius = particle.m_Radius * m_ObjectScale; for (int j = 0; j < m_Colliders.Count; j++) { DynamicBoneCollider dynamicBoneCollider = m_Colliders[j]; if (dynamicBoneCollider != null && dynamicBoneCollider.get_enabled()) { dynamicBoneCollider.Collide(ref particle.m_Position, particleRadius); } } } if (m_FreezeAxis != 0) { switch (m_FreezeAxis) { case FreezeAxis.X: val.SetNormalAndPosition(particle2.m_Transform.get_right(), particle2.m_Position); break; case FreezeAxis.Y: val.SetNormalAndPosition(particle2.m_Transform.get_up(), particle2.m_Position); break; case FreezeAxis.Z: val.SetNormalAndPosition(particle2.m_Transform.get_forward(), particle2.m_Position); break; } Particle particle5 = particle; particle5.m_Position -= val.get_normal() * val.GetDistanceToPoint(particle.m_Position); } Vector3 val6 = particle2.m_Position - particle.m_Position; float magnitude3 = val6.get_magnitude(); if (magnitude3 > 0f) { Particle particle6 = particle; particle6.m_Position += val6 * ((magnitude3 - magnitude) / magnitude3); } } }
// Token: 0x06002717 RID: 10007 RVA: 0x000C07A4 File Offset: 0x000BEBA4 private void UpdateParticles2() { Plane plane = default(Plane); for (int i = 1; i < this.m_Particles.Count; i++) { DynamicBone.Particle particle = this.m_Particles[i]; DynamicBone.Particle particle2 = this.m_Particles[particle.m_ParentIndex]; float magnitude; if (particle.m_Transform != null) { magnitude = (particle2.m_Transform.position - particle.m_Transform.position).magnitude; } else { magnitude = particle2.m_Transform.localToWorldMatrix.MultiplyVector(particle.m_EndOffset).magnitude; } float num = Mathf.Lerp(1f, particle.m_Stiffness, this.m_Weight); if (num > 0f || particle.m_Elasticity > 0f) { Matrix4x4 localToWorldMatrix = particle2.m_Transform.localToWorldMatrix; localToWorldMatrix.SetColumn(3, particle2.m_Position); Vector3 a; if (particle.m_Transform != null) { a = localToWorldMatrix.MultiplyPoint3x4(particle.m_Transform.localPosition); } else { a = localToWorldMatrix.MultiplyPoint3x4(particle.m_EndOffset); } Vector3 a2 = a - particle.m_Position; particle.m_Position += a2 * particle.m_Elasticity; if (num > 0f) { a2 = a - particle.m_Position; float magnitude2 = a2.magnitude; float num2 = magnitude * (1f - num) * 2f; if (magnitude2 > num2) { particle.m_Position += a2 * ((magnitude2 - num2) / magnitude2); } } } if (this.m_Colliders != null) { float particleRadius = particle.m_Radius * this.m_ObjectScale; for (int j = 0; j < this.m_Colliders.Count; j++) { DynamicBoneCollider dynamicBoneCollider = this.m_Colliders[j]; if (dynamicBoneCollider != null && dynamicBoneCollider.enabled) { dynamicBoneCollider.Collide(ref particle.m_Position, particleRadius); } } } if (this.m_FreezeAxis != DynamicBone.FreezeAxis.None) { DynamicBone.FreezeAxis freezeAxis = this.m_FreezeAxis; if (freezeAxis != DynamicBone.FreezeAxis.X) { if (freezeAxis != DynamicBone.FreezeAxis.Y) { if (freezeAxis == DynamicBone.FreezeAxis.Z) { plane.SetNormalAndPosition(particle2.m_Transform.forward, particle2.m_Position); } } else { plane.SetNormalAndPosition(particle2.m_Transform.up, particle2.m_Position); } } else { plane.SetNormalAndPosition(particle2.m_Transform.right, particle2.m_Position); } particle.m_Position -= plane.normal * plane.GetDistanceToPoint(particle.m_Position); } Vector3 a3 = particle2.m_Position - particle.m_Position; float magnitude3 = a3.magnitude; if (magnitude3 > 0f) { particle.m_Position += a3 * ((magnitude3 - magnitude) / magnitude3); } } }