private void CalculateVelocity() { Vector3G vector3G = new Vector3G(); double num = (double)Time.time - (double)this.lastVelocityCalc; Character character = base.idMain; Vector3 vector3 = (!character ? base.transform.position : character.origin); Vector3G vector3G1 = new Vector3G(ref vector3); double num1 = 1 / num; vector3G.x = num1 * (vector3G1.x - this.lastPosPrecise.x); vector3G.y = num1 * (vector3G1.y - this.lastPosPrecise.y); vector3G.z = num1 * (vector3G1.z - this.lastPosPrecise.z); Matrix4x4G matrix4x4G = new Matrix4x4G(base.transform.worldToLocalMatrix); Matrix4x4G.Mult3x3(ref vector3G, ref matrix4x4G, out this.localVelocityPrecise); this.lastVelocityCalc = Time.time; this.speedPrecise = Math.Sqrt(this.localVelocityPrecise.x * this.localVelocityPrecise.x + this.localVelocityPrecise.z * this.localVelocityPrecise.z); if (this.speedPrecise >= (double)this.movement.configuration.minMoveSpeed) { double num2 = 1 / this.speedPrecise; this.movementNormalPrecise.x = (double)this.localVelocity.x * num2; this.movementNormalPrecise.y = (double)this.localVelocity.z * num2; double num3 = this.anglePrecise; this.anglePrecise = Math.Atan2(this.movementNormalPrecise.x, this.movementNormalPrecise.y) / 3.14159265358979 * 180; float single = this.movement.configuration.maxTurnSpeed; if (single > 0f && this.anglePrecise != num3 && this.lastAngleSpeedPrecise >= 0.05) { double num4 = (double)Time.deltaTime * (double)single; if (Precise.MoveTowardsAngle(ref num3, ref this.anglePrecise, ref num4, out this.anglePrecise)) { double num5 = this.anglePrecise / 180 * 3.14159265358979; this.movementNormalPrecise.x = Math.Sin(num5); this.movementNormalPrecise.y = Math.Cos(num5); } } this.lastAngleSpeedPrecise = this.speedPrecise; } else { this.speedPrecise = 0; this.movementNormalPrecise.x = 0; this.movementNormalPrecise.y = 0; if (this.lastAngleSpeedPrecise > 0) { float single1 = this.movement.configuration.maxTimeBetweenTurns; float single2 = single1; if (single1 > 0f) { PlayerAnimation playerAnimation = this; playerAnimation.lastAngleSpeedPrecise = playerAnimation.lastAngleSpeedPrecise - (double)(Time.deltaTime / single2); } } } this.lastPosPrecise = vector3G1; this.lastPos = vector3; this.movementNormal = this.movementNormalPrecise.f; this.speed = (float)this.speedPrecise; this.angle = (float)this.anglePrecise; this.localVelocity = this.localVelocityPrecise.f; }
internal static void ApplyTransitionAlterations(Camera camera, CameraFX fx, bool useFX) { Matrix4x4G matrix4x4G; Matrix4x4G matrix4x4G1; if (!useFX) { camera.ExtractCameraMatrixWorldToCamera(out matrix4x4G); camera.ExtractCameraMatrixProjection(out matrix4x4G1); int num = CameraFX.g_trans.Update(ref matrix4x4G, ref matrix4x4G1); if ((num & 1) == 1) { camera.ResetWorldToCameraMatrix(); camera.worldToCameraMatrix = matrix4x4G.f; } if ((num & 2) == 2) { camera.ResetProjectionMatrix(); camera.projectionMatrix = matrix4x4G1.f; } } else { int num1 = CameraFX.g_trans.Update(ref fx.worldToCameraMatrix, ref fx.projectionMatrix); if ((num1 & 1) == 1) { camera.worldToCameraMatrix = fx.worldToCameraMatrix.f; Matrix4x4G.Inverse(ref fx.worldToCameraMatrix, out fx.cameraToWorldMatrix); } if ((num1 & 2) == 2) { camera.projectionMatrix = fx.projectionMatrix.f; } } }
// Token: 0x06003B75 RID: 15221 RVA: 0x000D42E4 File Offset: 0x000D24E4 public bool UnProject(ref Vector3G win, out Vector3G objectCoordinate) { Matrix4x4G matrix4x4G; Matrix4x4G.Mult(ref this.projection, ref this.modelview, ref matrix4x4G); Matrix4x4G matrix4x4G2; if (!Matrix4x4G.Inverse(ref matrix4x4G, ref matrix4x4G2)) { objectCoordinate = default(Vector3G); return(false); } Vector4G vector4G; vector4G.x = (win.x - this.offset.x) / this.size.x * 2.0 - 1.0; vector4G.y = (win.y - this.offset.y) / this.size.y * 2.0 - 1.0; vector4G.z = -win.z; vector4G.w = 1.0; Vector4G vector4G2; Matrix4x4G.Mult(ref vector4G, ref matrix4x4G2, ref vector4G2); if (vector4G2.w == 0.0) { objectCoordinate = default(Vector3G); return(false); } vector4G2.w = 1.0 / vector4G2.w; objectCoordinate.x = vector4G2.x * vector4G2.w; objectCoordinate.y = vector4G2.y * vector4G2.w; objectCoordinate.z = vector4G2.z * vector4G2.w; return(true); }
public static Matrix4x4G Transpose(Matrix4x4G v) { Matrix4x4G matrixxg; Matrix4x4G.Transpose(ref v, out matrixxg); return(matrixxg); }
private void GatherInfo(CCMotor motor) { if (motor.isGrounded && !motor.isSliding) { this.groundLocalVelocity = this.localVelocity; this.groundWorldVelocity = this.worldVelocity; this.groundLocalAngularVelocity = this.localAngularVelocity; this.groundLocalVelocityMag = this.localVelocityMag; this.groundWorldVelocityMag = this.worldVelocityMag; this.groundLocalAngularVelocityMag = this.localAngularVelocityMag; } else { this.groundLocalVelocity = new Vector3G(); this.groundWorldVelocity = new Vector3G(); this.groundLocalAngularVelocity = new Vector3G(); this.groundLocalVelocityMag = 0.0; this.groundWorldVelocityMag = 0.0; this.groundLocalAngularVelocityMag = 0.0; } this.inputForce.x = motor.input.moveDirection.x; this.inputForce.y = motor.input.moveDirection.y; this.inputForce.z = motor.input.moveDirection.z; Matrix4x4G.Mult3x3(ref this.inputForce, ref this.worldToLocal, out this.inputForce); this.inputForce.x *= this.cfg.inputForceMultiplier.x; this.inputForce.y *= this.cfg.inputForceMultiplier.y; this.inputForce.z *= this.cfg.inputForceMultiplier.z; }
public bool UnProject(ref Vector3G win, out Vector3G objectCoordinate) { Matrix4x4G matrixxg; Matrix4x4G matrixxg2; Vector4G vectorg; Vector4G vectorg2; Matrix4x4G.Mult(ref this.projection, ref this.modelview, out matrixxg); if (!Matrix4x4G.Inverse(ref matrixxg, out matrixxg2)) { objectCoordinate = new Vector3G(); return(false); } vectorg.x = (((win.x - this.offset.x) / this.size.x) * 2.0) - 1.0; vectorg.y = (((win.y - this.offset.y) / this.size.y) * 2.0) - 1.0; vectorg.z = -win.z; vectorg.w = 1.0; Matrix4x4G.Mult(ref vectorg, ref matrixxg2, out vectorg2); if (vectorg2.w == 0.0) { objectCoordinate = new Vector3G(); return(false); } vectorg2.w = 1.0 / vectorg2.w; objectCoordinate.x = vectorg2.x * vectorg2.w; objectCoordinate.y = vectorg2.y * vectorg2.w; objectCoordinate.z = vectorg2.z * vectorg2.w; return(true); }
public static Matrix4x4G Slerp(double t, Matrix4x4G a, Matrix4x4G b) { Matrix4x4G identity = Matrix4x4G.identity; Vector3G dotB = Slerp(t, DIR_X(a), DIR_X(b)); Vector3G up = Slerp(t, DIR_Y(a), DIR_Y(b)); Vector3G forward = Slerp(t, DIR_Z(a), DIR_Z(b)); QuaternionG rotation = LookRotation(forward, up); up = Rotate(rotation, Y3(Length(up))); if (CrossDot(forward, up, dotB) > 0.0) { dotB = Rotate(rotation, X3(-Length(dotB))); } else { dotB = Rotate(rotation, X3(Length(dotB))); } DIR_X(ref identity, dotB); DIR_Y(ref identity, up); DIR_Z(ref identity, forward); SCALE(ref identity, Linear(t, SCALE(a), SCALE(b))); TRANS(ref identity, Linear(t, TRANS(a), TRANS(b))); identity.m33 = Linear(t, a.m33, b.m33); return(identity); }
internal static void ApplyTransitionAlterations(Camera camera, CameraFX fx, bool useFX) { if (useFX) { int num = g_trans.Update(ref fx.worldToCameraMatrix, ref fx.projectionMatrix); if ((num & 1) == 1) { camera.worldToCameraMatrix = fx.worldToCameraMatrix.f; Matrix4x4G.Inverse(ref fx.worldToCameraMatrix, out fx.cameraToWorldMatrix); } if ((num & 2) == 2) { camera.projectionMatrix = fx.projectionMatrix.f; } } else { Matrix4x4G matrixxg; Matrix4x4G matrixxg2; camera.ExtractCameraMatrixWorldToCamera(out matrixxg); camera.ExtractCameraMatrixProjection(out matrixxg2); int num2 = g_trans.Update(ref matrixxg, ref matrixxg2); if ((num2 & 1) == 1) { camera.ResetWorldToCameraMatrix(); camera.worldToCameraMatrix = matrixxg.f; } if ((num2 & 2) == 2) { camera.ResetProjectionMatrix(); camera.projectionMatrix = matrixxg2.f; } } }
// Token: 0x06002BC8 RID: 11208 RVA: 0x000A375C File Offset: 0x000A195C internal static void ApplyTransitionAlterations(Camera camera, global::CameraFX fx, bool useFX) { if (useFX) { int num = global::CameraFX.g_trans.Update(ref fx.worldToCameraMatrix, ref fx.projectionMatrix); if ((num & 1) == 1) { camera.worldToCameraMatrix = fx.worldToCameraMatrix.f; Matrix4x4G.Inverse(ref fx.worldToCameraMatrix, ref fx.cameraToWorldMatrix); } if ((num & 2) == 2) { camera.projectionMatrix = fx.projectionMatrix.f; } } else { Matrix4x4G matrix4x4G; Precise.ExtractCameraMatrixWorldToCamera(camera, ref matrix4x4G); Matrix4x4G matrix4x4G2; Precise.ExtractCameraMatrixProjection(camera, ref matrix4x4G2); int num2 = global::CameraFX.g_trans.Update(ref matrix4x4G, ref matrix4x4G2); if ((num2 & 1) == 1) { camera.ResetWorldToCameraMatrix(); camera.worldToCameraMatrix = matrix4x4G.f; } if ((num2 & 2) == 2) { camera.ResetProjectionMatrix(); camera.projectionMatrix = matrix4x4G2.f; } } }
// Token: 0x06002E36 RID: 11830 RVA: 0x000B0710 File Offset: 0x000AE910 private void GatherInfo(global::CCMotor motor) { if (motor.isGrounded && !motor.isSliding) { this.groundLocalVelocity = this.localVelocity; this.groundWorldVelocity = this.worldVelocity; this.groundLocalAngularVelocity = this.localAngularVelocity; this.groundLocalVelocityMag = this.localVelocityMag; this.groundWorldVelocityMag = this.worldVelocityMag; this.groundLocalAngularVelocityMag = this.localAngularVelocityMag; } else { this.groundLocalVelocity = default(Vector3G); this.groundWorldVelocity = default(Vector3G); this.groundLocalAngularVelocity = default(Vector3G); this.groundLocalVelocityMag = 0.0; this.groundWorldVelocityMag = 0.0; this.groundLocalAngularVelocityMag = 0.0; } this.inputForce.x = (double)motor.input.moveDirection.x; this.inputForce.y = (double)motor.input.moveDirection.y; this.inputForce.z = (double)motor.input.moveDirection.z; Matrix4x4G.Mult3x3(ref this.inputForce, ref this.worldToLocal, ref this.inputForce); this.inputForce.x = this.inputForce.x * (double)this.cfg.inputForceMultiplier.x; this.inputForce.y = this.inputForce.y * (double)this.cfg.inputForceMultiplier.y; this.inputForce.z = this.inputForce.z * (double)this.cfg.inputForceMultiplier.z; }
public bool UnProject(ref Vector3G win, out Vector3G objectCoordinate) { objectCoordinate = new Vector3G(); Matrix4x4G matrix4x4G; Matrix4x4G matrix4x4G1; Vector4G vector4G = new Vector4G(); Vector4G vector4G1; Matrix4x4G.Mult(ref this.projection, ref this.modelview, out matrix4x4G); if (!Matrix4x4G.Inverse(ref matrix4x4G, out matrix4x4G1)) { objectCoordinate = new Vector3G(); return(false); } vector4G.x = (win.x - this.offset.x) / this.size.x * 2 - 1; vector4G.y = (win.y - this.offset.y) / this.size.y * 2 - 1; vector4G.z = -win.z; vector4G.w = 1; Matrix4x4G.Mult(ref vector4G, ref matrix4x4G1, out vector4G1); if (vector4G1.w == 0) { objectCoordinate = new Vector3G(); return(false); } vector4G1.w = 1 / vector4G1.w; objectCoordinate.x = vector4G1.x * vector4G1.w; objectCoordinate.y = vector4G1.y * vector4G1.w; objectCoordinate.z = vector4G1.z * vector4G1.w; return(true); }
public static Matrix4x4G Inverse(Matrix4x4G v) { Matrix4x4G matrixxg; Matrix4x4G.Inverse(ref v, out matrixxg); return(matrixxg); }
// Token: 0x06000420 RID: 1056 RVA: 0x00014844 File Offset: 0x00012A44 private void CalculateVelocity() { double num = (double)Time.time - (double)this.lastVelocityCalc; global::Character idMain = base.idMain; Vector3 vector = (!idMain) ? base.transform.position : idMain.origin; Vector3G vector3G; vector3G..ctor(ref vector); double num2 = 1.0 / num; Vector3G vector3G2; vector3G2.x = num2 * (vector3G.x - this.lastPosPrecise.x); vector3G2.y = num2 * (vector3G.y - this.lastPosPrecise.y); vector3G2.z = num2 * (vector3G.z - this.lastPosPrecise.z); Matrix4x4G matrix4x4G; matrix4x4G..ctor(base.transform.worldToLocalMatrix); Matrix4x4G.Mult3x3(ref vector3G2, ref matrix4x4G, ref this.localVelocityPrecise); this.lastVelocityCalc = Time.time; this.speedPrecise = Math.Sqrt(this.localVelocityPrecise.x * this.localVelocityPrecise.x + this.localVelocityPrecise.z * this.localVelocityPrecise.z); if (this.speedPrecise < (double)this.movement.configuration.minMoveSpeed) { this.speedPrecise = 0.0; this.movementNormalPrecise.x = 0.0; this.movementNormalPrecise.y = 0.0; float maxTimeBetweenTurns; if (this.lastAngleSpeedPrecise > 0.0 && (maxTimeBetweenTurns = this.movement.configuration.maxTimeBetweenTurns) > 0f) { this.lastAngleSpeedPrecise -= (double)(Time.deltaTime / maxTimeBetweenTurns); } } else { double num3 = 1.0 / this.speedPrecise; this.movementNormalPrecise.x = (double)this.localVelocity.x * num3; this.movementNormalPrecise.y = (double)this.localVelocity.z * num3; double num4 = this.anglePrecise; this.anglePrecise = Math.Atan2(this.movementNormalPrecise.x, this.movementNormalPrecise.y) / 3.1415926535897931 * 180.0; float maxTurnSpeed = this.movement.configuration.maxTurnSpeed; if (maxTurnSpeed > 0f && this.anglePrecise != num4 && this.lastAngleSpeedPrecise >= 0.05) { double num5 = (double)Time.deltaTime * (double)maxTurnSpeed; if (Precise.MoveTowardsAngle(ref num4, ref this.anglePrecise, ref num5, ref this.anglePrecise)) { double num6 = this.anglePrecise / 180.0 * 3.1415926535897931; this.movementNormalPrecise.x = Math.Sin(num6); this.movementNormalPrecise.y = Math.Cos(num6); } } this.lastAngleSpeedPrecise = this.speedPrecise; } this.lastPosPrecise = vector3G; this.lastPos = vector; this.movementNormal = this.movementNormalPrecise.f; this.speed = (float)this.speedPrecise; this.angle = (float)this.anglePrecise; this.localVelocity = this.localVelocityPrecise.f; }
public void Set(float duration, TransitionFunction func) { this.start = CameraFX.CameraTransitionData.timeSource; this.lastTime = this.start; this.end = this.start + duration; this.view = this.lastView; this.proj = this.lastProj; this.func = func; }
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 CalculateVelocity() { Vector3G vectorg2; double num = Time.time - this.lastVelocityCalc; Character idMain = base.idMain; Vector3 v = (idMain == null) ? base.transform.position : idMain.origin; Vector3G vectorg = new Vector3G(ref v); double num2 = 1.0 / num; vectorg2.x = num2 * (vectorg.x - this.lastPosPrecise.x); vectorg2.y = num2 * (vectorg.y - this.lastPosPrecise.y); vectorg2.z = num2 * (vectorg.z - this.lastPosPrecise.z); Matrix4x4G b = new Matrix4x4G(base.transform.worldToLocalMatrix); Matrix4x4G.Mult3x3(ref vectorg2, ref b, out this.localVelocityPrecise); this.lastVelocityCalc = Time.time; this.speedPrecise = Math.Sqrt((this.localVelocityPrecise.x * this.localVelocityPrecise.x) + (this.localVelocityPrecise.z * this.localVelocityPrecise.z)); if (this.speedPrecise < this.movement.configuration.minMoveSpeed) { float num3; this.speedPrecise = 0.0; this.movementNormalPrecise.x = 0.0; this.movementNormalPrecise.y = 0.0; if ((this.lastAngleSpeedPrecise > 0.0) && ((num3 = this.movement.configuration.maxTimeBetweenTurns) > 0f)) { this.lastAngleSpeedPrecise -= Time.deltaTime / num3; } } else { double num4 = 1.0 / this.speedPrecise; this.movementNormalPrecise.x = this.localVelocity.x * num4; this.movementNormalPrecise.y = this.localVelocity.z * num4; double anglePrecise = this.anglePrecise; this.anglePrecise = (Math.Atan2(this.movementNormalPrecise.x, this.movementNormalPrecise.y) / 3.1415926535897931) * 180.0; float maxTurnSpeed = this.movement.configuration.maxTurnSpeed; if (((maxTurnSpeed > 0f) && (this.anglePrecise != anglePrecise)) && (this.lastAngleSpeedPrecise >= 0.05)) { double maxDelta = Time.deltaTime * maxTurnSpeed; if (Precise.MoveTowardsAngle(ref anglePrecise, ref this.anglePrecise, ref maxDelta, out this.anglePrecise)) { double a = (this.anglePrecise / 180.0) * 3.1415926535897931; this.movementNormalPrecise.x = Math.Sin(a); this.movementNormalPrecise.y = Math.Cos(a); } } this.lastAngleSpeedPrecise = this.speedPrecise; } this.lastPosPrecise = vectorg; this.lastPos = v; this.movementNormal = this.movementNormalPrecise.f; this.speed = (float)this.speedPrecise; this.angle = (float)this.anglePrecise; this.localVelocity = this.localVelocityPrecise.f; }
private void Update() { double aspectRatio = (this.aspect <= 0f) ? (((double)Screen.height) / ((double)Screen.width)) : ((double)this.aspect); this.unity = Matrix4x4.Perspective(this.fov, (float)aspectRatio, this.near, this.far); double fov = this.fov; double near = this.near; double far = this.far; Matrix4x4G.Perspective(ref fov, ref aspectRatio, ref near, ref far, out this.facep); this.unity2 = this.facep.f; }
private Matrix4x4G MultG(Matrix4x4G a, Matrix4x4G b) { Matrix4x4G matrixxg; if (this.revG) { Matrix4x4G.Mult(ref b, ref a, out matrixxg); return(matrixxg); } Matrix4x4G.Mult(ref a, ref b, out matrixxg); return(matrixxg); }
// Token: 0x06003DE5 RID: 15845 RVA: 0x000DF454 File Offset: 0x000DD654 private void Update() { double num = (this.aspect <= 0f) ? ((double)Screen.height / (double)Screen.width) : ((double)this.aspect); this.unity = Matrix4x4.Perspective(this.fov, (float)num, this.near, this.far); double num2 = (double)this.fov; double num3 = (double)this.near; double num4 = (double)this.far; Matrix4x4G.Perspective(ref num2, ref num, ref num3, ref num4, ref this.facep); this.unity2 = this.facep.f; }
private Matrix4x4G MultG(Matrix4x4G a, Matrix4x4G b) { Matrix4x4G matrix4x4G; if (!this.revG) { Matrix4x4G.Mult(ref a, ref b, out matrix4x4G); } else { Matrix4x4G.Mult(ref b, ref a, out matrix4x4G); } return matrix4x4G; }
private Matrix4x4G MultG(Matrix4x4G a, Matrix4x4G b) { Matrix4x4G matrix4x4G; if (!this.revG) { Matrix4x4G.Mult(ref a, ref b, out matrix4x4G); } else { Matrix4x4G.Mult(ref b, ref a, out matrix4x4G); } return(matrix4x4G); }
// Token: 0x06003DD2 RID: 15826 RVA: 0x000DEBA8 File Offset: 0x000DCDA8 private Matrix4x4G MultG(Matrix4x4G a, Matrix4x4G b) { Matrix4x4G result; if (this.revG) { Matrix4x4G.Mult(ref b, ref a, ref result); } else { Matrix4x4G.Mult(ref a, ref b, ref result); } return(result); }
// Token: 0x06003DFB RID: 15867 RVA: 0x000E059C File Offset: 0x000DE79C private void OnDrawGizmos() { Matrix4x4G matrix4x4G; Precise.ExtractLocalToWorld(base.transform, ref matrix4x4G); Matrix4x4 localToWorldMatrix = base.transform.localToWorldMatrix; Vector3 vector = localToWorldMatrix.MultiplyPoint(Vector3.zero); Vector3 vector2 = localToWorldMatrix.MultiplyPoint(Vector3.forward); Vector3 vector3 = localToWorldMatrix.MultiplyPoint(Vector3.up); Vector3 vector4 = localToWorldMatrix.MultiplyPoint(Vector3.right); Vector3G vector3G; vector3G.x = 1.0; vector3G.y = 0.0; vector3G.z = 0.0; Vector3G vector3G2; Matrix4x4G.Mult(ref vector3G, ref matrix4x4G, ref vector3G2); vector3G.x = 0.0; vector3G.y = 1.0; vector3G.z = 0.0; Vector3G vector3G3; Matrix4x4G.Mult(ref vector3G, ref matrix4x4G, ref vector3G3); vector3G.x = 0.0; vector3G.y = 0.0; vector3G.z = 1.0; Vector3G vector3G4; Matrix4x4G.Mult(ref vector3G, ref matrix4x4G, ref vector3G4); vector3G.x = 0.0; vector3G.y = 0.0; vector3G.z = 0.0; Vector3G vector3G5; Matrix4x4G.Mult(ref vector3G, ref matrix4x4G, ref vector3G5); Gizmos.color = Color.red * new Color(1f, 1f, 1f, 0.5f); Gizmos.DrawLine(vector, vector4); Gizmos.color = Color.green * new Color(1f, 1f, 1f, 0.5f); Gizmos.DrawLine(vector, vector3); Gizmos.color = Color.blue * new Color(1f, 1f, 1f, 0.5f); Gizmos.DrawLine(vector, vector2); Gizmos.color = Color.red * new Color(1f, 1f, 1f, 1f); Gizmos.DrawLine(vector3G5.f, vector3G2.f); Gizmos.color = Color.green * new Color(1f, 1f, 1f, 1f); Gizmos.DrawLine(vector3G5.f, vector3G3.f); Gizmos.color = Color.blue * new Color(1f, 1f, 1f, 1f); Gizmos.DrawLine(vector3G5.f, vector3G4.f); }
public int Update(ref Matrix4x4G currentView, ref Matrix4x4G currentProj) { int num; try { float single = CameraFX.CameraTransitionData.timeSource; if (this.end > single) { float single1 = Mathf.InverseLerp(this.start, this.end, single); if (single1 < 1f) { single1 = this.func.Evaluate(single1); Matrix4x4G camera = TransitionFunctions.SlerpWorldToCamera((double)single1, this.view, currentView); Matrix4x4G matrix4x4G = TransitionFunctions.Linear((double)single1, this.proj, currentProj); this.lastTime = single; if (!Matrix4x4G.Equals(ref camera, ref currentView)) { currentView = camera; if (Matrix4x4G.Equals(ref matrix4x4G, ref currentProj)) { num = 1; return(num); } else { currentProj = matrix4x4G; num = 3; return(num); } } else if (!Matrix4x4G.Equals(ref matrix4x4G, ref currentProj)) { currentProj = matrix4x4G; num = 2; return(num); } } } num = 0; } finally { this.lastView = currentView; this.lastProj = currentProj; } return(num); }
private void Update() { Matrix4x4 unity; Matrix4x4G facep; if ((this.transforms != null) && (this.transforms.Length > 0)) { if (this.revMul) { int index = this.transforms.Length - 1; unity = this.transforms[index].unity; facep = this.transforms[index].facep; index--; while (index >= 0) { unity = this.transforms[index].unity * unity; facep = this.MultG(this.transforms[index].facep, facep); index--; } } else { int num2 = 0; unity = this.transforms[num2].unity; facep = this.transforms[num2].facep; num2++; while (num2 < this.transforms.Length) { unity *= this.transforms[num2].unity; facep = this.MultG(facep, this.transforms[num2].facep); num2++; } } } else { unity = Matrix4x4.identity; facep = Matrix4x4G.identity; } if (this.projection != null) { unity = this.projection.UnityMatrix * unity; facep = this.MultG(this.projection.GMatrix, facep); } this.unity = unity; this.facep = facep; }
private void OnDrawGizmos() { Matrix4x4G matrix4x4G; Vector3G vector3G; Vector3G vector3G1; Vector3G vector3G2; Vector3G vector3G3; Vector3G vector3G4 = new Vector3G(); base.transform.ExtractLocalToWorld(out matrix4x4G); Matrix4x4 matrix4x4 = base.transform.localToWorldMatrix; Vector3 vector3 = matrix4x4.MultiplyPoint(Vector3.zero); Vector3 vector31 = matrix4x4.MultiplyPoint(Vector3.forward); Vector3 vector32 = matrix4x4.MultiplyPoint(Vector3.up); Vector3 vector33 = matrix4x4.MultiplyPoint(Vector3.right); vector3G4.x = 1; vector3G4.y = 0; vector3G4.z = 0; Matrix4x4G.Mult(ref vector3G4, ref matrix4x4G, out vector3G); vector3G4.x = 0; vector3G4.y = 1; vector3G4.z = 0; Matrix4x4G.Mult(ref vector3G4, ref matrix4x4G, out vector3G1); vector3G4.x = 0; vector3G4.y = 0; vector3G4.z = 1; Matrix4x4G.Mult(ref vector3G4, ref matrix4x4G, out vector3G2); vector3G4.x = 0; vector3G4.y = 0; vector3G4.z = 0; Matrix4x4G.Mult(ref vector3G4, ref matrix4x4G, out vector3G3); Gizmos.color = Color.red * new Color(1f, 1f, 1f, 0.5f); Gizmos.DrawLine(vector3, vector33); Gizmos.color = Color.green * new Color(1f, 1f, 1f, 0.5f); Gizmos.DrawLine(vector3, vector32); Gizmos.color = Color.blue * new Color(1f, 1f, 1f, 0.5f); Gizmos.DrawLine(vector3, vector31); Gizmos.color = Color.red * new Color(1f, 1f, 1f, 1f); Gizmos.DrawLine(vector3G3.f, vector3G.f); Gizmos.color = Color.green * new Color(1f, 1f, 1f, 1f); Gizmos.DrawLine(vector3G3.f, vector3G1.f); Gizmos.color = Color.blue * new Color(1f, 1f, 1f, 1f); Gizmos.DrawLine(vector3G3.f, vector3G2.f); }
private void OnDrawGizmos() { Matrix4x4G matrixxg; Vector3G vectorg; Vector3G vectorg2; Vector3G vectorg3; Vector3G vectorg4; Vector3G vectorg5; base.transform.ExtractLocalToWorld(out matrixxg); Matrix4x4 localToWorldMatrix = base.transform.localToWorldMatrix; Vector3 from = localToWorldMatrix.MultiplyPoint(Vector3.zero); Vector3 to = localToWorldMatrix.MultiplyPoint(Vector3.forward); Vector3 vector3 = localToWorldMatrix.MultiplyPoint(Vector3.up); Vector3 vector4 = localToWorldMatrix.MultiplyPoint(Vector3.right); vectorg5.x = 1.0; vectorg5.y = 0.0; vectorg5.z = 0.0; Matrix4x4G.Mult(ref vectorg5, ref matrixxg, out vectorg); vectorg5.x = 0.0; vectorg5.y = 1.0; vectorg5.z = 0.0; Matrix4x4G.Mult(ref vectorg5, ref matrixxg, out vectorg2); vectorg5.x = 0.0; vectorg5.y = 0.0; vectorg5.z = 1.0; Matrix4x4G.Mult(ref vectorg5, ref matrixxg, out vectorg3); vectorg5.x = 0.0; vectorg5.y = 0.0; vectorg5.z = 0.0; Matrix4x4G.Mult(ref vectorg5, ref matrixxg, out vectorg4); Gizmos.color = Color.red * new Color(1f, 1f, 1f, 0.5f); Gizmos.DrawLine(from, vector4); Gizmos.color = Color.green * new Color(1f, 1f, 1f, 0.5f); Gizmos.DrawLine(from, vector3); Gizmos.color = Color.blue * new Color(1f, 1f, 1f, 0.5f); Gizmos.DrawLine(from, to); Gizmos.color = Color.red * new Color(1f, 1f, 1f, 1f); Gizmos.DrawLine(vectorg4.f, vectorg.f); Gizmos.color = Color.green * new Color(1f, 1f, 1f, 1f); Gizmos.DrawLine(vectorg4.f, vectorg2.f); Gizmos.color = Color.blue * new Color(1f, 1f, 1f, 1f); Gizmos.DrawLine(vectorg4.f, vectorg3.f); }
// Token: 0x06002BD6 RID: 11222 RVA: 0x000A3D54 File Offset: 0x000A1F54 public int Update(ref Matrix4x4G currentView, ref Matrix4x4G currentProj) { int result; try { float timeSource = global::CameraFX.CameraTransitionData.timeSource; if (this.end > timeSource) { float num = Mathf.InverseLerp(this.start, this.end, timeSource); if (num < 1f) { num = this.func.Evaluate(num); Matrix4x4G matrix4x4G = global::TransitionFunctions.SlerpWorldToCamera((double)num, this.view, currentView); Matrix4x4G matrix4x4G2 = global::TransitionFunctions.Linear((double)num, this.proj, currentProj); this.lastTime = timeSource; if (!Matrix4x4G.Equals(ref matrix4x4G, ref currentView)) { currentView = matrix4x4G; if (!Matrix4x4G.Equals(ref matrix4x4G2, ref currentProj)) { currentProj = matrix4x4G2; return(3); } return(1); } else if (!Matrix4x4G.Equals(ref matrix4x4G2, ref currentProj)) { currentProj = matrix4x4G2; return(2); } } } result = 0; } finally { this.lastView = currentView; this.lastProj = currentProj; } return(result); }
public int Update(ref Matrix4x4G currentView, ref Matrix4x4G currentProj) { int num3; try { float timeSource = CameraFX.CameraTransitionData.timeSource; if (this.end > timeSource) { float t = Mathf.InverseLerp(this.start, this.end, timeSource); if (t < 1f) { t = this.func.Evaluate(t); Matrix4x4G a = TransitionFunctions.SlerpWorldToCamera((double)t, this.view, currentView); Matrix4x4G matrixxg2 = TransitionFunctions.Linear((double)t, this.proj, currentProj); this.lastTime = timeSource; if (!Matrix4x4G.Equals(ref a, ref currentView)) { currentView = a; if (!Matrix4x4G.Equals(ref matrixxg2, ref currentProj)) { currentProj = matrixxg2; return(3); } return(1); } if (!Matrix4x4G.Equals(ref matrixxg2, ref currentProj)) { currentProj = matrixxg2; return(2); } } } num3 = 0; } finally { this.lastView = currentView; this.lastProj = currentProj; } return(num3); }
public static Matrix4x4G Evaluate(this TransitionFunction f, double t, Matrix4x4G a, Matrix4x4G b) { switch (f) { case TransitionFunction.Linear: return(Linear(t, a, b)); case TransitionFunction.Round: return(Round(t, a, b)); case TransitionFunction.Floor: return(Floor(t, a, b)); case TransitionFunction.Ceil: return(Ceil(t, a, b)); case TransitionFunction.Spline: return(Spline(t, a, b)); } throw new ArgumentOutOfRangeException("v", "Attempted use of unrecognized TransitionFunction enum value"); }
public static Matrix4x4G Transpose(Matrix4x4G v) { Matrix4x4G matrix4x4G; Matrix4x4G.Transpose(ref v, out matrix4x4G); return matrix4x4G; }
public static Matrix4x4G Linear(double t, Matrix4x4G a, Matrix4x4G b) { return TransitionFunctions.Sum(TransitionFunctions.Mul(a, 1 - t), TransitionFunctions.Mul(b, t)); }
public static Matrix4x4G Floor(double t, Matrix4x4G a, Matrix4x4G b) { return (t >= 1 ? b : a); }
private static void TRANS(ref Matrix4x4G a, Vector3G v) { TransitionFunctions.SET_X3(ref a, v); }
private static void SET_X3(ref Matrix4x4G m, Vector3G v) { m.m03 = v.x; m.m13 = v.y; m.m23 = v.z; }
private static void SET_X1(ref Matrix4x4G m, Vector3G v) { m.m01 = v.x; m.m11 = v.y; m.m21 = v.z; }
private static void SET_3X(ref Matrix4x4G m, Vector3G v) { m.m30 = v.x; m.m31 = v.y; m.m32 = v.z; }
private static void SET_1X(ref Matrix4x4G m, Vector3G v) { m.m10 = v.x; m.m11 = v.y; m.m12 = v.z; }
private static void SCALE(ref Matrix4x4G a, Vector3G v) { TransitionFunctions.SET_3X(ref a, v); }
private static Vector3G GET_X3(Matrix4x4G a) { return TransitionFunctions.VECT3F(a.m03, a.m13, a.m23); }
public static Matrix4x4G Sum(Matrix4x4G a, Matrix4x4G b) { Matrix4x4G matrix4x4G = new Matrix4x4G(); matrix4x4G.m00 = a.m00 + b.m00; matrix4x4G.m10 = a.m10 + b.m10; matrix4x4G.m20 = a.m20 + b.m20; matrix4x4G.m30 = a.m30 + b.m30; matrix4x4G.m01 = a.m01 + b.m01; matrix4x4G.m11 = a.m11 + b.m11; matrix4x4G.m21 = a.m21 + b.m21; matrix4x4G.m31 = a.m31 + b.m31; matrix4x4G.m02 = a.m02 + b.m02; matrix4x4G.m12 = a.m12 + b.m12; matrix4x4G.m22 = a.m22 + b.m22; matrix4x4G.m32 = a.m32 + b.m32; matrix4x4G.m03 = a.m03 + b.m03; matrix4x4G.m13 = a.m13 + b.m13; matrix4x4G.m23 = a.m23 + b.m23; matrix4x4G.m33 = a.m33 + b.m33; return matrix4x4G; }
private static Vector3G SCALE(Matrix4x4G a) { return TransitionFunctions.GET_3X(a); }
private static Vector3G DIR_Z(Matrix4x4G a) { return TransitionFunctions.GET_X2(a); }
private static void SET_0X(ref Matrix4x4G m, Vector3G v) { m.m00 = v.x; m.m01 = v.y; m.m02 = v.z; }
private static void DIR_Z(ref Matrix4x4G a, Vector3G v) { TransitionFunctions.SET_X2(ref a, v); }
private static void SET_2X(ref Matrix4x4G m, Vector3G v) { m.m20 = v.x; m.m21 = v.y; m.m22 = v.z; }
private static Vector3G GET_0X(Matrix4x4G a) { return TransitionFunctions.VECT3F(a.m00, a.m01, a.m02); }
private static void SET_X0(ref Matrix4x4G m, Vector3G v) { m.m00 = v.x; m.m10 = v.y; m.m20 = v.z; }
private static Vector3G GET_1X(Matrix4x4G a) { return TransitionFunctions.VECT3F(a.m10, a.m11, a.m12); }
private static void SET_X2(ref Matrix4x4G m, Vector3G v) { m.m02 = v.x; m.m12 = v.y; m.m22 = v.z; }
private static Vector3G GET_2X(Matrix4x4G a) { return TransitionFunctions.VECT3F(a.m20, a.m21, a.m22); }
private static Vector3G TRANS(Matrix4x4G a) { return TransitionFunctions.GET_X3(a); }
private static Vector3G GET_3X(Matrix4x4G a) { return TransitionFunctions.VECT3F(a.m30, a.m31, a.m32); }
public static Matrix4x4G Evaluate(this TransitionFunction f, double t, Matrix4x4G a, Matrix4x4G b) { switch (f) { case TransitionFunction.Linear: { return TransitionFunctions.Linear(t, a, b); } case TransitionFunction.Round: { return TransitionFunctions.Round(t, a, b); } case TransitionFunction.Floor: { return TransitionFunctions.Floor(t, a, b); } case TransitionFunction.Ceil: { return TransitionFunctions.Ceil(t, a, b); } case TransitionFunction.Spline: { return TransitionFunctions.Spline(t, a, b); } } throw new ArgumentOutOfRangeException("v", "Attempted use of unrecognized TransitionFunction enum value"); }
private static Vector3G GET_X0(Matrix4x4G a) { return TransitionFunctions.VECT3F(a.m00, a.m10, a.m20); }
public static Matrix4x4G Inverse(Matrix4x4G v) { Matrix4x4G matrix4x4G; Matrix4x4G.Inverse(ref v, out matrix4x4G); return matrix4x4G; }
private static Vector3G GET_X1(Matrix4x4G a) { return TransitionFunctions.VECT3F(a.m01, a.m11, a.m21); }
public static Matrix4x4G Mul(Matrix4x4G a, double b) { Matrix4x4G matrix4x4G = new Matrix4x4G(); matrix4x4G.m00 = a.m00 * b; matrix4x4G.m10 = a.m10 * b; matrix4x4G.m20 = a.m20 * b; matrix4x4G.m30 = a.m30 * b; matrix4x4G.m01 = a.m01 * b; matrix4x4G.m11 = a.m11 * b; matrix4x4G.m21 = a.m21 * b; matrix4x4G.m31 = a.m31 * b; matrix4x4G.m02 = a.m02 * b; matrix4x4G.m12 = a.m12 * b; matrix4x4G.m22 = a.m22 * b; matrix4x4G.m32 = a.m32 * b; matrix4x4G.m03 = a.m03 * b; matrix4x4G.m13 = a.m13 * b; matrix4x4G.m23 = a.m23 * b; matrix4x4G.m33 = a.m33 * b; return matrix4x4G; }
private static Vector3G GET_X2(Matrix4x4G a) { return TransitionFunctions.VECT3F(a.m02, a.m12, a.m22); }