private void PushPosition() { VectorStamp stamp; VectorStamp stamp2; Vector3 eyesOrigin; Vector3 eulerAngles; Character character; this.worldToLocal.f = this.otherParent.worldToLocalMatrix; this.localToWorld.f = this.otherParent.localToWorldMatrix; stamp.timeStamp = Time.time; stamp.valid = true; if ((this._motor != null) && ((character = this._motor.idMain as Character) != null)) { eulerAngles = character.eyesAngles.eulerAngles; eyesOrigin = character.eyesOrigin; } else { eulerAngles = this.otherParent.eulerAngles; eyesOrigin = this.otherParent.position; } stamp.vector.x = eyesOrigin.x; stamp.vector.y = eyesOrigin.y; stamp.vector.z = eyesOrigin.z; stamp2.vector.x = eulerAngles.x; stamp2.vector.y = eulerAngles.y; stamp2.vector.z = eulerAngles.z; stamp2.timeStamp = Time.time; stamp2.valid = true; if (this.lastPosition.valid && (this.lastPosition.timeStamp != stamp.timeStamp)) { double num = 1.0 / ((double)(stamp.timeStamp - this.lastPosition.timeStamp)); this.worldVelocity.x = (stamp.vector.x - this.lastPosition.vector.x) * num; this.worldVelocity.y = (stamp.vector.y - this.lastPosition.vector.y) * num; this.worldVelocity.z = (stamp.vector.z - this.lastPosition.vector.z) * num; Matrix4x4G.Mult3x3(ref this.worldVelocity, ref this.worldToLocal, out this.localVelocity); } this.impulseForce.Sample(ref this.localVelocity, stamp.timeStamp); this.lastPosition = stamp; if (this.lastRotation.valid && (this.lastRotation.timeStamp != stamp2.timeStamp)) { double num2 = 1.0 / ((double)(stamp2.timeStamp - this.lastRotation.timeStamp)); Precise.DeltaAngle(ref this.lastRotation.vector.x, ref stamp2.vector.x, out this.localAngularVelocity.x); Precise.DeltaAngle(ref this.lastRotation.vector.y, ref stamp2.vector.y, out this.localAngularVelocity.y); Precise.DeltaAngle(ref this.lastRotation.vector.z, ref stamp2.vector.z, out this.localAngularVelocity.z); this.localAngularVelocity.x *= num2; this.localAngularVelocity.y *= num2; this.localAngularVelocity.z *= num2; } this.impulseTorque.Sample(ref this.localAngularVelocity, stamp2.timeStamp); this.lastRotation = stamp2; this.localVelocityMag = Math.Sqrt(((this.localVelocity.x * this.localVelocity.x) + (this.localVelocity.y * this.localVelocity.y)) + (this.localVelocity.z * this.localVelocity.z)); this.worldVelocityMag = Math.Sqrt(((this.worldVelocity.x * this.worldVelocity.x) + (this.worldVelocity.y * this.worldVelocity.y)) + (this.worldVelocity.z * this.worldVelocity.z)); this.localAngularVelocityMag = Math.Sqrt(((this.localAngularVelocity.x * this.localAngularVelocity.x) + (this.localAngularVelocity.y * this.localAngularVelocity.y)) + (this.localAngularVelocity.z * this.localAngularVelocity.z)); }
// Token: 0x06002E35 RID: 11829 RVA: 0x000B02B8 File Offset: 0x000AE4B8 private void PushPosition() { this.worldToLocal.f = this.otherParent.worldToLocalMatrix; this.localToWorld.f = this.otherParent.localToWorldMatrix; global::HeadBob.VectorStamp vectorStamp; vectorStamp.timeStamp = Time.time; vectorStamp.valid = true; global::Character character; Vector3 eulerAngles; Vector3 vector; if (this._motor && (character = (this._motor.idMain as global::Character))) { eulerAngles = character.eyesAngles.eulerAngles; vector = character.eyesOrigin; } else { eulerAngles = this.otherParent.eulerAngles; vector = this.otherParent.position; } vectorStamp.vector.x = (double)vector.x; vectorStamp.vector.y = (double)vector.y; vectorStamp.vector.z = (double)vector.z; global::HeadBob.VectorStamp vectorStamp2; vectorStamp2.vector.x = (double)eulerAngles.x; vectorStamp2.vector.y = (double)eulerAngles.y; vectorStamp2.vector.z = (double)eulerAngles.z; vectorStamp2.timeStamp = Time.time; vectorStamp2.valid = true; if (this.lastPosition.valid && this.lastPosition.timeStamp != vectorStamp.timeStamp) { double num = 1.0 / (double)(vectorStamp.timeStamp - this.lastPosition.timeStamp); this.worldVelocity.x = (vectorStamp.vector.x - this.lastPosition.vector.x) * num; this.worldVelocity.y = (vectorStamp.vector.y - this.lastPosition.vector.y) * num; this.worldVelocity.z = (vectorStamp.vector.z - this.lastPosition.vector.z) * num; Matrix4x4G.Mult3x3(ref this.worldVelocity, ref this.worldToLocal, ref this.localVelocity); } this.impulseForce.Sample(ref this.localVelocity, vectorStamp.timeStamp); this.lastPosition = vectorStamp; if (this.lastRotation.valid && this.lastRotation.timeStamp != vectorStamp2.timeStamp) { double num2 = 1.0 / (double)(vectorStamp2.timeStamp - this.lastRotation.timeStamp); Precise.DeltaAngle(ref this.lastRotation.vector.x, ref vectorStamp2.vector.x, ref this.localAngularVelocity.x); Precise.DeltaAngle(ref this.lastRotation.vector.y, ref vectorStamp2.vector.y, ref this.localAngularVelocity.y); Precise.DeltaAngle(ref this.lastRotation.vector.z, ref vectorStamp2.vector.z, ref this.localAngularVelocity.z); this.localAngularVelocity.x = this.localAngularVelocity.x * num2; this.localAngularVelocity.y = this.localAngularVelocity.y * num2; this.localAngularVelocity.z = this.localAngularVelocity.z * num2; } this.impulseTorque.Sample(ref this.localAngularVelocity, vectorStamp2.timeStamp); this.lastRotation = vectorStamp2; this.localVelocityMag = Math.Sqrt(this.localVelocity.x * this.localVelocity.x + this.localVelocity.y * this.localVelocity.y + this.localVelocity.z * this.localVelocity.z); this.worldVelocityMag = Math.Sqrt(this.worldVelocity.x * this.worldVelocity.x + this.worldVelocity.y * this.worldVelocity.y + this.worldVelocity.z * this.worldVelocity.z); this.localAngularVelocityMag = Math.Sqrt(this.localAngularVelocity.x * this.localAngularVelocity.x + this.localAngularVelocity.y * this.localAngularVelocity.y + this.localAngularVelocity.z * this.localAngularVelocity.z); }
private void PushPosition() { HeadBob.VectorStamp vectorStamp = new HeadBob.VectorStamp(); HeadBob.VectorStamp vectorStamp1 = new HeadBob.VectorStamp(); Vector3 vector3; Vector3 vector31; this.worldToLocal.f = this.otherParent.worldToLocalMatrix; this.localToWorld.f = this.otherParent.localToWorldMatrix; vectorStamp.timeStamp = Time.time; vectorStamp.valid = true; if (this._motor) { Character character = this._motor.idMain as Character; Character character1 = character; if (!character) { goto Label1; } vector31 = character1.eyesAngles.eulerAngles; vector3 = character1.eyesOrigin; goto Label0; } Label1: vector31 = this.otherParent.eulerAngles; vector3 = this.otherParent.position; Label0: vectorStamp.vector.x = (double)vector3.x; vectorStamp.vector.y = (double)vector3.y; vectorStamp.vector.z = (double)vector3.z; vectorStamp1.vector.x = (double)vector31.x; vectorStamp1.vector.y = (double)vector31.y; vectorStamp1.vector.z = (double)vector31.z; vectorStamp1.timeStamp = Time.time; vectorStamp1.valid = true; if (this.lastPosition.valid && this.lastPosition.timeStamp != vectorStamp.timeStamp) { double num = 1 / (double)(vectorStamp.timeStamp - this.lastPosition.timeStamp); this.worldVelocity.x = (vectorStamp.vector.x - this.lastPosition.vector.x) * num; this.worldVelocity.y = (vectorStamp.vector.y - this.lastPosition.vector.y) * num; this.worldVelocity.z = (vectorStamp.vector.z - this.lastPosition.vector.z) * num; Matrix4x4G.Mult3x3(ref this.worldVelocity, ref this.worldToLocal, out this.localVelocity); } this.impulseForce.Sample(ref this.localVelocity, vectorStamp.timeStamp); this.lastPosition = vectorStamp; if (this.lastRotation.valid && this.lastRotation.timeStamp != vectorStamp1.timeStamp) { double num1 = 1 / (double)(vectorStamp1.timeStamp - this.lastRotation.timeStamp); Precise.DeltaAngle(ref this.lastRotation.vector.x, ref vectorStamp1.vector.x, out this.localAngularVelocity.x); Precise.DeltaAngle(ref this.lastRotation.vector.y, ref vectorStamp1.vector.y, out this.localAngularVelocity.y); Precise.DeltaAngle(ref this.lastRotation.vector.z, ref vectorStamp1.vector.z, out this.localAngularVelocity.z); this.localAngularVelocity.x = this.localAngularVelocity.x * num1; this.localAngularVelocity.y = this.localAngularVelocity.y * num1; this.localAngularVelocity.z = this.localAngularVelocity.z * num1; } this.impulseTorque.Sample(ref this.localAngularVelocity, vectorStamp1.timeStamp); this.lastRotation = vectorStamp1; this.localVelocityMag = Math.Sqrt(this.localVelocity.x * this.localVelocity.x + this.localVelocity.y * this.localVelocity.y + this.localVelocity.z * this.localVelocity.z); this.worldVelocityMag = Math.Sqrt(this.worldVelocity.x * this.worldVelocity.x + this.worldVelocity.y * this.worldVelocity.y + this.worldVelocity.z * this.worldVelocity.z); this.localAngularVelocityMag = Math.Sqrt(this.localAngularVelocity.x * this.localAngularVelocity.x + this.localAngularVelocity.y * this.localAngularVelocity.y + this.localAngularVelocity.z * this.localAngularVelocity.z); }