// Token: 0x06002E3B RID: 11835 RVA: 0x000B0CF0 File Offset: 0x000AEEF0 public void CopyTo(ref global::HeadBob.Weight other) { if (other.additionalPositions != this.additionalPositions && this.additionalPositions != null) { Array.Copy(this.additionalPositions, other.additionalPositions, this.additionalPositions.Length); } other.rotation = this.rotation; other.position = this.position; if (other.stack != null && other.stack.IsForkOf(this.stack)) { other.stack.Join(); } }
// Token: 0x06002E2F RID: 11823 RVA: 0x000AEB58 File Offset: 0x000ACD58 private void Solve(ref global::HeadBob.Weight weight, ref double dt) { Vector3G vector3G; vector3G.x = dt * this.groundLocalVelocity.x * (double)this.cfg.forceSpeedMultiplier.x; vector3G.y = dt * this.groundLocalVelocity.y * (double)this.cfg.forceSpeedMultiplier.y; vector3G.z = dt * this.groundLocalVelocity.z * (double)this.cfg.forceSpeedMultiplier.z; Vector3G fE = weight.position.fE; Vector3G fE2 = weight.rotation.fE; weight.position.fE = default(Vector3G); weight.rotation.fE = default(Vector3G); if (this.anyAdditionalCurves) { int i = 0; while (i < this.additionalCurveCount) { global::BobForceCurve bobForceCurve = this.cfg.additionalCurves[i]; double num; switch (bobForceCurve.source) { case global::BobForceCurveSource.LocalMovementMagnitude: num = this.groundLocalVelocityMag; break; case global::BobForceCurveSource.LocalMovementX: num = this.groundLocalVelocity.x; break; case global::BobForceCurveSource.LocalMovementY: num = this.groundLocalVelocity.y; break; case global::BobForceCurveSource.LocalMovementZ: num = this.groundLocalVelocity.z; break; case global::BobForceCurveSource.WorldMovementMagnitude: num = this.groundWorldVelocityMag; break; case global::BobForceCurveSource.WorldMovementX: num = this.groundWorldVelocity.x; break; case global::BobForceCurveSource.WorldMovementY: num = this.groundWorldVelocity.y; break; case global::BobForceCurveSource.WorldMovementZ: num = this.groundWorldVelocity.z; break; case global::BobForceCurveSource.LocalVelocityMagnitude: num = this.localVelocityMag; break; case global::BobForceCurveSource.LocalVelocityX: num = this.localVelocity.x; break; case global::BobForceCurveSource.LocalVelocityY: num = this.localVelocity.y; break; case global::BobForceCurveSource.LocalVelocityZ: goto IL_204; case global::BobForceCurveSource.WorldVelocityMagnitude: num = this.worldVelocityMag; break; case global::BobForceCurveSource.WorldVelocityX: num = this.worldVelocity.x; break; case global::BobForceCurveSource.WorldVelocityY: num = this.worldVelocity.y; break; case global::BobForceCurveSource.WorldVelocityZ: num = this.worldVelocity.z; break; case global::BobForceCurveSource.RotationMagnitude: num = this.localAngularVelocityMag; break; case global::BobForceCurveSource.RotationPitch: num = this.localAngularVelocity.x; break; case global::BobForceCurveSource.RotationYaw: num = this.localAngularVelocity.y; break; case global::BobForceCurveSource.RotationRoll: num = this.localAngularVelocity.z; break; case global::BobForceCurveSource.TurnMagnitude: num = this.groundLocalAngularVelocityMag; break; case global::BobForceCurveSource.TurnPitch: num = this.groundLocalAngularVelocity.x; break; case global::BobForceCurveSource.TurnYaw: num = this.groundLocalAngularVelocity.y; break; case global::BobForceCurveSource.TurnRoll: num = this.groundLocalAngularVelocity.z; break; default: goto IL_204; } IL_2DF: global::BobForceCurveTarget target = bobForceCurve.target; if (target == global::BobForceCurveTarget.Position || target != global::BobForceCurveTarget.Rotation) { bobForceCurve.Calculate(ref weight.additionalPositions[i], ref num, ref dt, ref weight.position.fE); } else { bobForceCurve.Calculate(ref weight.additionalPositions[i], ref num, ref dt, ref weight.rotation.fE); } i++; continue; IL_204: num = this.localVelocity.z; goto IL_2DF; } } if (this.cfg.impulseForceSmooth > 0f) { Vector3G.SmoothDamp(ref weight.position.fI, ref this.impulseForce.accel, ref weight.position.fIV, this.cfg.impulseForceSmooth, this.cfg.impulseForceMaxChangeAcceleration, ref dt); } else { weight.position.fI = this.impulseForce.accel; } if (this.cfg.angleImpulseForceSmooth > 0f) { Vector3G.SmoothDamp(ref weight.rotation.fI, ref this.impulseTorque.accel, ref weight.rotation.fIV, this.cfg.angleImpulseForceSmooth, this.cfg.angleImpulseForceMaxChangeAcceleration, ref dt); } else { weight.rotation.fI = this.impulseTorque.accel; } weight.position.fE.x = weight.position.fE.x + (this.inputForce.x + weight.position.fI.x * (double)this.cfg.impulseForceScale.x); weight.position.fE.y = weight.position.fE.y + (this.inputForce.y + weight.position.fI.y * (double)this.cfg.impulseForceScale.y); weight.position.fE.z = weight.position.fE.z + (this.inputForce.z + weight.position.fI.z * (double)this.cfg.impulseForceScale.z); weight.rotation.fE.x = weight.rotation.fE.x + weight.rotation.fI.x * (double)this.cfg.angularImpulseForceScale.x; weight.rotation.fE.y = weight.rotation.fE.y + weight.rotation.fI.y * (double)this.cfg.angularImpulseForceScale.y; weight.rotation.fE.z = weight.rotation.fE.z + weight.rotation.fI.z * (double)this.cfg.angularImpulseForceScale.z; Vector3G value = weight.position.value; value.x /= (double)this.cfg.elipsoidRadii.x; value.y /= (double)this.cfg.elipsoidRadii.y; value.z /= (double)this.cfg.elipsoidRadii.z; double num2 = value.x * value.x + value.y * value.y + value.z * value.z; if (num2 > 1.0) { num2 = 1.0 / Math.Sqrt(num2); value.x *= num2; value.y *= num2; value.z *= num2; } value.x *= (double)this.cfg.elipsoidRadii.x; value.y *= (double)this.cfg.elipsoidRadii.y; value.z *= (double)this.cfg.elipsoidRadii.z; weight.stack.Simulate(ref dt, ref weight.position.fE, ref weight.rotation.fE); weight.position.acceleration.x = weight.position.fE.x - fE.x + (value.x * (double)(-(double)this.cfg.springConstant.x) - weight.position.velocity.x * (double)this.cfg.springDampen.x) * (double)this.cfg.weightMass; weight.position.acceleration.y = weight.position.fE.y - fE.y + (value.y * (double)(-(double)this.cfg.springConstant.y) - weight.position.velocity.y * (double)this.cfg.springDampen.y) * (double)this.cfg.weightMass; weight.position.acceleration.z = weight.position.fE.z - fE.z + (value.z * (double)(-(double)this.cfg.springConstant.z) - weight.position.velocity.z * (double)this.cfg.springDampen.z) * (double)this.cfg.weightMass; weight.position.velocity.x = weight.position.velocity.x + weight.position.acceleration.x * dt; weight.position.velocity.y = weight.position.velocity.y + weight.position.acceleration.y * dt; weight.position.velocity.z = weight.position.velocity.z + weight.position.acceleration.z * dt; if (!float.IsInfinity(this.cfg.maxVelocity.x)) { if (weight.position.velocity.x < (double)(-(double)this.cfg.maxVelocity.x)) { weight.position.value.x = weight.position.value.x - (double)this.cfg.maxVelocity.x * dt; } else if (weight.position.velocity.x > (double)this.cfg.maxVelocity.x) { weight.position.value.x = weight.position.value.x + (double)this.cfg.maxVelocity.x * dt; } else { weight.position.value.x = weight.position.value.x + weight.position.velocity.x * dt; } } else { weight.position.value.x = weight.position.value.x + weight.position.velocity.x * dt; } if (!float.IsInfinity(this.cfg.maxVelocity.y)) { if (weight.position.velocity.y < (double)(-(double)this.cfg.maxVelocity.y)) { weight.position.value.y = weight.position.value.y - (double)this.cfg.maxVelocity.y * dt; } else if (weight.position.velocity.y > (double)this.cfg.maxVelocity.y) { weight.position.value.y = weight.position.value.y + (double)this.cfg.maxVelocity.y * dt; } else { weight.position.value.y = weight.position.value.y + weight.position.velocity.y * dt; } } else { weight.position.value.y = weight.position.value.y + weight.position.velocity.y * dt; } if (!float.IsInfinity(this.cfg.maxVelocity.z)) { if (weight.position.velocity.z < (double)(-(double)this.cfg.maxVelocity.z)) { weight.position.value.z = weight.position.value.z - (double)this.cfg.maxVelocity.z * dt; } else if (weight.position.velocity.z > (double)this.cfg.maxVelocity.z) { weight.position.value.z = weight.position.value.z + (double)this.cfg.maxVelocity.z * dt; } else { weight.position.value.z = weight.position.value.z + weight.position.velocity.z * dt; } } else { weight.position.value.z = weight.position.value.z + weight.position.velocity.z * dt; } weight.rotation.acceleration.x = weight.rotation.fE.x - fE2.x + (weight.rotation.value.x * (double)(-(double)this.cfg.angularSpringConstant.x) - weight.rotation.velocity.x * (double)this.cfg.angularSpringDampen.x) * (double)this.cfg.angularWeightMass; weight.rotation.acceleration.y = weight.rotation.fE.y - fE2.y + (weight.rotation.value.y * (double)(-(double)this.cfg.angularSpringConstant.y) - weight.rotation.velocity.y * (double)this.cfg.angularSpringDampen.y) * (double)this.cfg.angularWeightMass; weight.rotation.acceleration.z = weight.rotation.fE.z - fE2.z + (weight.rotation.value.z * (double)(-(double)this.cfg.angularSpringConstant.z) - weight.rotation.velocity.z * (double)this.cfg.angularSpringDampen.z) * (double)this.cfg.angularWeightMass; weight.rotation.velocity.x = weight.rotation.velocity.x + weight.rotation.acceleration.x * dt; weight.rotation.velocity.y = weight.rotation.velocity.y + weight.rotation.acceleration.y * dt; weight.rotation.velocity.z = weight.rotation.velocity.z + weight.rotation.acceleration.z * dt; weight.rotation.value.x = weight.rotation.value.x + weight.rotation.velocity.x * dt; weight.rotation.value.y = weight.rotation.value.y + weight.rotation.velocity.y * dt; weight.rotation.value.z = weight.rotation.value.z + weight.rotation.velocity.z * dt; }