Projectile Help! please

  • Ok so i want my player to throw projectile that will arc and reach a certain mark , but i want it to change its speed, angle, and gravity according to how far it is from the mark that i chose.

    i tried using the distance formula inorder to optimize it, but i faced some problems.

    1) the projectile's speed is fast then slower as it is near the mark then faster again as it gets further from the mark, i dont want that, i want it to simply curve while getting slower.

    2) since the projectile curves i needed it to have an angle that is higher than the one facing the mark however, at shorter distances it didn't need to be as much higher from the mark as in longer distances, i wasn't able to optimize it perfectly inorder to land o the mark.

  • IGamesProduction try this tutorial ... ng-physics

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • the tutorial doesn't help, it doesn't change power or angle automatically based on a certain X_mark

  • You definitely need 1 variable each for those parameters (bullet behavior I assume). As for the values of those variables, probably need some math guys to solve your problem.

  • yeah... thanks for your help anyways. i started trying to do some math myself.. it worked great on some distances and horrible on others ... i couldn't do exactly what i wanted. so i deleted the idea..

  • There are multiple trajectory angles and launch velocities that can be given to a projectile to get it to land in a certain position. If you make the velocity a constant then you can solve for the angle, if you make the launch angle constant then you can solve for the velocity.

    Physiscs Stack Exchange gives the answer - you need to solve two simultaneous equations, one for a constant velocity movement in the x direction and one for the gravity influenced up and down motion in the y direction (solve by assuming the time for each movement is the same). If you have two variables (angle and velocity) then you cannot solve it. If the start and end points are at different y values then y (or, rather, delta y) is not zero - the equation will still work.

    If you apply your answer to the physics behavior then these equations do not account for linear damping, so they will make inaccurate predictions if you have linear damping set to above zero.

  • i will try it thanks alot..

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)