public override void SetAimDirection(Vector3 newAim) { if (!(newAim == Vector3.zero)) { float num = UnityEngine.Time.time - lastAimSetTime; lastAimSetTime = UnityEngine.Time.time; AttackEntity attackEntity = GetAttackEntity(); if ((bool)attackEntity) { newAim = attackEntity.ModifyAIAim(newAim, GetAimSwayScalar()); } if (base.isMounted) { BaseMountable baseMountable = GetMounted(); Vector3 eulerAngles = baseMountable.transform.eulerAngles; Quaternion quaternion = Quaternion.Euler(Quaternion.LookRotation(newAim, baseMountable.transform.up).eulerAngles); Vector3 eulerAngles2 = Quaternion.LookRotation(base.transform.InverseTransformDirection(quaternion * Vector3.forward), base.transform.up).eulerAngles; eulerAngles2 = BaseMountable.ConvertVector(eulerAngles2); Quaternion quaternion2 = Quaternion.Euler(Mathf.Clamp(eulerAngles2.x, baseMountable.pitchClamp.x, baseMountable.pitchClamp.y), Mathf.Clamp(eulerAngles2.y, baseMountable.yawClamp.x, baseMountable.yawClamp.y), eulerAngles.z); newAim = BaseMountable.ConvertVector(Quaternion.LookRotation(base.transform.TransformDirection(quaternion2 * Vector3.forward), base.transform.up).eulerAngles); } eyes.rotation = (base.isMounted ? Quaternion.Slerp(eyes.rotation, Quaternion.Euler(newAim), num * 70f) : Quaternion.Lerp(eyes.rotation, Quaternion.LookRotation(newAim, base.transform.up), num * 25f)); viewAngles = eyes.rotation.eulerAngles; ServerRotation = eyes.rotation; } }
public override void SetAimDirection(Vector3 newAim) { Quaternion quaternion; if (newAim == Vector3.zero) { return; } AttackEntity attackEntity = base.GetAttackEntity(); if (attackEntity) { newAim = attackEntity.ModifyAIAim(newAim, this.GetAimSwayScalar()); } if (base.isMounted) { BaseMountable mounted = base.GetMounted(); Vector3 vector3 = mounted.transform.eulerAngles; quaternion = Quaternion.LookRotation(newAim, mounted.transform.up); Quaternion quaternion1 = Quaternion.Euler(quaternion.eulerAngles); Quaternion quaternion2 = Quaternion.LookRotation(base.transform.InverseTransformDirection(quaternion1 * Vector3.forward), base.transform.up); Vector3 vector31 = quaternion2.eulerAngles; vector31 = BaseMountable.ConvertVector(vector31); Quaternion quaternion3 = Quaternion.Euler(Mathf.Clamp(vector31.x, mounted.pitchClamp.x, mounted.pitchClamp.y), Mathf.Clamp(vector31.y, mounted.yawClamp.x, mounted.yawClamp.y), vector3.z); Quaternion quaternion4 = Quaternion.LookRotation(base.transform.TransformDirection(quaternion3 * Vector3.forward), base.transform.up); newAim = BaseMountable.ConvertVector(quaternion4.eulerAngles); } this.eyes.rotation = (base.isMounted ? Quaternion.Slerp(this.eyes.rotation, Quaternion.Euler(newAim), UnityEngine.Time.smoothDeltaTime * 70f) : Quaternion.Lerp(this.eyes.rotation, Quaternion.LookRotation(newAim, base.transform.up), UnityEngine.Time.deltaTime * 25f)); quaternion = this.eyes.rotation; this.viewAngles = quaternion.eulerAngles; this.ServerRotation = this.eyes.rotation; }
public static void DoAimbot() { Vector3 vector = GetEnemyVector(); if (vector != Vector3.zero) { Quaternion rotation = Quaternion.LookRotation(vector, LocalPlayer.Entity.eyes.transform.up); LocalPlayer.Entity.input.SetViewVars(BaseMountable.ConvertVector(rotation.eulerAngles)); } }
public void FixedUpdate() { Vector3 worldVelocity; Vector3 vector3 = this.currentAimDir; if (this.currentTarget != null && this.IsPowered()) { float component = this.projectileTest.Get().GetComponent <ServerProjectile>().speed; Vector3 vector31 = this.EntityCenterPoint(this.currentTarget); float single = Vector3.Distance(vector31, this.eyePoint.transform.position); float single1 = single / component; Vector3 worldVelocity1 = vector31 + (this.currentTarget.GetWorldVelocity() * single1); single1 = Vector3.Distance(worldVelocity1, this.eyePoint.transform.position) / component; worldVelocity1 = vector31 + (this.currentTarget.GetWorldVelocity() * single1); if (this.currentTarget.GetWorldVelocity().magnitude > 0.1f) { float single2 = Mathf.Sin(Time.time * 3f) * (1f + single1 * 0.5f); worldVelocity = this.currentTarget.GetWorldVelocity(); worldVelocity1 = worldVelocity1 + (worldVelocity.normalized * single2); } worldVelocity = worldVelocity1 - this.eyePoint.transform.position; this.currentAimDir = worldVelocity.normalized; if (single > this.scanRadius) { this.currentTarget = null; } } Quaternion quaternion = Quaternion.LookRotation(this.currentAimDir, base.transform.up); Vector3 vector32 = quaternion.eulerAngles; vector32 = BaseMountable.ConvertVector(vector32); float single3 = Mathf.InverseLerp(0f, 90f, -vector32.x); float single4 = Mathf.Lerp(15f, -75f, single3); Quaternion quaternion1 = Quaternion.Euler(0f, vector32.y, 0f); this.yaw.transform.localRotation = quaternion1; Quaternion quaternion2 = this.pitch.transform.localRotation; float single5 = quaternion2.eulerAngles.x; quaternion2 = this.pitch.transform.localRotation; Quaternion quaternion3 = Quaternion.Euler(single5, quaternion2.eulerAngles.y, single4); this.pitch.transform.localRotation = quaternion3; if (this.currentAimDir != vector3) { base.SendNetworkUpdate(BasePlayer.NetworkQueue.Update); } }
public void Server_SetDir(RPCMessage msg) { if (!IsStatic()) { BasePlayer player = msg.player; if (player.CanBuild() && player.IsBuildingAuthed() && Interface.CallHook("OnCCTVDirectionChange", this, player) == null) { Vector3 direction = Vector3Ex.Direction(player.eyes.position, yaw.transform.position); direction = base.transform.InverseTransformDirection(direction); Vector3 vector = BaseMountable.ConvertVector(Quaternion.LookRotation(direction).eulerAngles); pitchAmount = vector.x; yawAmount = vector.y; pitchAmount = Mathf.Clamp(pitchAmount, pitchClamp.x, pitchClamp.y); yawAmount = Mathf.Clamp(yawAmount, yawClamp.x, yawClamp.y); Quaternion localRotation = Quaternion.Euler(pitchAmount, 0f, 0f); Quaternion localRotation2 = Quaternion.Euler(0f, yawAmount, 0f); pitch.transform.localRotation = localRotation; yaw.transform.localRotation = localRotation2; SendNetworkUpdate(); } } }