public float GetSpreadChange(ShootTick tick) { Quaternion eyeDirection = Quaternion.Euler(storedTicks[tick.tickFired + 1]); Quaternion bulletRotation = Quaternion.LookRotation(tick.bullet.startVel); return(Vector3.Angle(eyeDirection * Vector3.forward, tick.bullet.startVel.normalized)); }
public void AddShootTick(ProtoBuf.ProjectileShoot.Projectile firedProjectile, BaseProjectile projectile, ProtoBuf.ProjectileShoot.Projectile bullet) { ShootTick tick = new ShootTick(); tick.tickFired = currentTick; tick.timeDelta = Time.realtimeSinceStartup - timeLastShotFired; tick.projectile = projectile; timeLastShotFired = Time.realtimeSinceStartup; tick.bullet = bullet; shootTicks.Add(firedProjectile.projectileID, tick); }
public float GetPathChange(ShootTick tick) { float pathChange = 0f; Vector2 lastPos = storedTicks[tick.tickFired - 20]; for (int i = tick.tickFired - 19; i < tick.tickFired; i++) { Mathf.Abs(Vector2.Angle(storedTicks[i], lastPos)); lastPos = storedTicks[i]; } return(pathChange); }
public Vector2 GetRecoilChange(ShootTick tick) { Vector2 originalAimPos = storedTicks[tick.tickFired]; int ticksAhead = 0; //JakePlugin.Write(string.Format("Recoil Yaw Min:{0} Yaw Max:{1} Pitch Min: {2} Pitch Max: {3}", tick.projectile.recoil.recoilYawMin, tick.projectile.recoil.recoilYawMax, tick.projectile.recoil.recoilPitchMin, tick.projectile.recoil.recoilPitchMax, tick.projectile.recoil.recoilPitchMax)); while (tick.tickFired < storedTicks.Count) { ticksAhead++; if (ticksAhead >= 4) { Vector2 returnVector = storedTicks[tick.tickFired] - originalAimPos; returnVector = new Vector2(Mathf.Abs(returnVector.y), Mathf.Abs(returnVector.x)); return(returnVector); } tick.tickFired++; } return(new Vector2(float.MaxValue, float.MaxValue)); } //Both functions should return float from 0 - 100f+, indicating violation level
public float CheckBoneSnapping(ShootTick tick) { float distanceOff = 0f; if (tick.hitInfo == null) { JakePlugin.Write("Null Tick for boneSnapping"); return(float.MaxValue); } if (tick.hitInfo.HitEntity != null) { if (tick.hitPlayer) { BasePlayer player = (BasePlayer)tick.hitInfo.HitEntity; Vector3 bonePos = player.skeletonProperties.FindBone(tick.hitInfo.HitBone).bone.transform.position; Vector3 boneWorldPos = bonePos + player.transform.position; JakePlugin.Write(tick.hitInfo.HitBone, bonePos); } } return(distanceOff); }