Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- xTarget = target.transform.position.x;
- yTarget = target.transform.position.y;
- xCurrent = transform.position.x;
- yCurrent = transform.position.y;
- xDistance = xCurrent - xTarget;
- yDistance = yTarget - yCurrent;
- xSpeed = (float) Math.Sqrt(100f * Math.Pow(xDistance, 2f)/(384.16f + Math.Pow(xDistance, 2f)));
- flyTime = Math.Abs(xDistance / xSpeed);
- Debug.Log(flyTime);
- ySpeed = yDistance / flyTime + flyTime * 4.9f;
- launchSpeed.x = (xSpeed);
- launchSpeed.y = (ySpeed);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement