Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // calculated bullet drop
- targetDrop.X = (float) (Math.Pow(aimTarget.Distance, 2) - Math.Pow(AIM3D.Y, 2));
- targetDrop.Y = AIM3D.Y - Main.Player.Position.Y;
- dropAngle = (float)Math.Atan((Math.Pow(startSpeed, 2) - Math.Sqrt(Math.Pow(startSpeed, 4) - 9.81 * (9.81 * Math.Pow(targetDrop.X, 2) + 2 * targetDrop.Y * Math.Pow(startSpeed, 2)))) / (9.81 * targetDrop.X));
- A1 = (float)Math.Tan(dropAngle) - 0;
- B1 = 0-1;
- C1 = A1 * 0 + B1 * 0;
- A2 = (targetDrop.Y + 1) - targetDrop.Y;
- B2 = targetDrop.X - targetDrop.X;
- C2 = A1 * 0 + B1 * targetDrop.Y;
- float det = A1*B2 - A2*B1;
- if(det == 0)
- {
- //Lines are parallel
- }
- else
- {
- lineInterX = (B2 * C1 - B1 * C2) / det;
- lineInterY = (A1 * C2 - A2 * C1) / det;
- }
- AIM3D.Y += lineInterX - targetDrop.Y;
- AIM = Graphics.W2S(AIM3D); // project to screen
Advertisement
Add Comment
Please, Sign In to add comment