Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

123 Neutral

About phestermcs

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. For aiming, I add wind as if it's constant throughout the ball's trajectory. When the ball is hit, it's possible the wind will change enough during the ball's flight that the ball may go out-of-bounds, just like in real tennis. The player will need to aim more inside the court if they believe the ball could go out due to high winds, which will be rare. Right now I'm only working on 'normal' shots. To hit a given aim point, a stronger shot will have a lower angle than a weaker shot. I use this fact to adjust an initial angle based on the inputted relative amount of power (lower power, higher angle). The initial angle to adjust is determined by the right triangle formed from the starting position, the top of the net, and the top of the net less the height of the starting position, as if there where no downward forces acting on the ball. The shooting algorithm then shoots with maximum power, computes the error, adjusts the power, and repeats, until the aim distance is hit. I then rotate to account for any curving. I'm right in the middle of implementing this, but that's the basic approach I'm taking. I think the same approach will work for lob and drop shots, just with different coefficients used to compute the hit angle adjustment and shooting error correction.
  2. I've attached another doc on measured tennis ball drag and lift coefficients, if you're interested.
  3. Yes. The center is 3' high, while the ends are 3'6". Also, I don't think it's exactly a catenary as the center of the net is actually pulled down taught 6 inches, rather than hanging; the top of the net is straight from the ends to the center. I appreciate your input to and interest of my problem, but don't worry about it too much. I've learned enough since my original post that I probably don't need to implement the two-point boundary solver algorithm described in the attached article; shooting with RK4 will be fine. My real challenge now is incorporating the remaining player's inputs (adjusted by play conditions) into the shooting algorithm; shot type (normal, lob, drop), spin orientation, and a relative amount of power (think %) which is used in combination with a player's absolute max spin and power attributes to proportionally apply the 'power' to both spin rpm and velocity. The shooting algorithm needs to adjust both the translational direction and magnitude based on all this.
  4. phestermcs

    Numerical integration methods

    The book "Game Physics" by David H. Eberly, includes free-to-use C source for several numerical integrators (and a great deal of other game related routines). The source can be found here for free http://www.geometrictools.com/LibMathematics/NumericalAnalysis/NumericalAnalysis.html. Also, the book "Numerical Recipes in C++" has (not free to get, but free to use) source for several numerical integrators. Both books do spend some time describing trade-offs, which basically come down to accuracy/stability vs. performance.
  5. Taby, thanks for your continued thinking on this. The approach you've described is somewhat similar to what I've begun attempting. If you, or anyone who has read this thread, is interested in the solution, please let me know and I will eventually post (C# code) here. If not, thanks for your time!
  6. Thanks for your reply. I understand calculus, but I'm not fluent in it. I need to specify the ball's initial position vector (hit point), initial translational velocity (just 'shot-power'), initial rotational velocity vector (spin direction and rpm), and final vector position (aim point), and have returned the initial translation velocity vector (both direction and velocity) of the ball. If my calculus understanding is correct, since both the initial and final positions are supplied, and we're solving for the initial translation direction, the problem is classified as a two-point boundary problem. This is different than solving the same ODE as an initial boundary problem to animate the balls flight, which I already understand how to do using a simple RK4 ODE solver. First solving the ODE as a two-point boundary problem as part if simulating aiming the tennis ball, allows supplying all the initial dependents to solve the same ODE to animate the ball, and ensure it lands where it was aimed, all while considering gravity, air drag, AND the Magnus effect (so spin curves the ball appropriately). I reviewed the link you supplied and the Java code that was associated with it, and I don't believe it's applicable. Again, if my understanding of calculus is correct, while the java code does seem to fundamentally solve a kinematic ODE (computing thrust based on mass) using two points (initial location and velocity, and final location and velocity), the underlying ODE is fundamentally a 1st order, linear ODE, with a closed form solution, and can be solved algebraically (there actually is a way to solve that problem without iteration, see http://wiki.beyondun...ojectile_Aiming). I believe my problem is a 2nd order, non-linear ODE, with no closed form solution (thereby requiring a numerical solver) because the forces of drag (from air resistance) and lift (from spin) at any time are derivatives of translational and rotational velocity, both effected by those same changing forces (thus non-linear). The approach described in the article referenced in my original post is specifically intended to efficiently solve this class of ODE problems. My problem is even a little more complicated, in that I need to also ensure the ball's trajectory is above a certain height at a certain time (to clear the net, or to do a lob shot), and because the player's inputs are not absolute, but rather relative values of power and spin rpm. However, those problems will most likely be solved by applying a 'shooting' algorithm over the ODE solver. Do you understand the conceptual approach the article details? I can't tell if it's fundamentally an iterative based solver, can you? I ask because it may, in the end, be more efficient to use shooting with RK4 to simultaneously solve the two-point problem, the above-a-height problem, and determining the absolute translational and rotational velocities (power and spin) based on the player inputed relative power and spin. How well do you understand calculus, kinematics, and implemeting them in software? Regards, Paul
  7. Well, for example: I understand basically how an RK4 ODE solver works, enough to implement one given the 5 basic equations used. That took me about 30 minutes to get, and my primary resource was a couple of paragraphs and about 10 lines of sample code from the book Physics for Game Programmers. The article I attached to my original post is dense in calculus, with no code samples. I'm having trouble deciphering all of it, and by that I mean translating into a computer algorithm. I reason someone proficient in calculus could quickly understand the underlying conceptual approach the article describes; it quite clearly articulates all of the mathematical principles and equations it uses. By your question, I'm assuming that you understand the article, and by your statement, that you believe it would take you in particular much longer than 12 hours to convey that understanding to someone else, someone with anough rudimentary understanding of calculus to understand an implementation of the RK4 alogrithm. Is that a fair assumption? If you do understand the article, how long would it take you to implement (and here I assume you're also quite an experienced programmer)? From over 25 years experience in software development and enterprise consulting, I do not believe my estimate is orders-of-magnitude off, but if it ultimately is, then that's just what it took. If you're offering to actually help in someway, that would be fantastic. Regards, Paul
  8. I'm looking for someone to assist implementing the two-point boundary ODE solver described in this article http://digitalcommons.calpoly.edu/cgi/viewcontent.cgi?article=1002&context=pbli (also attached to this post), ideally someone who primarily understands calculus, secondarily programming. The assistance would be in the form of helping decipher the calculus in the above article and discussing its software implementation. Actual implementation would be done by myself. Note the article offers an approach that is more efficient and accurate than using 'shooting' with an RK4 based ODE solver. This is part of implementing a tennis game, and would be used to implement aiming the tennis ball (or more specifically used in determining the initial translational and rotational velocity vectors such that the tennis ball lands where it was aimed). The ODEs to be solved are the kinematic equations modeling tennis ball trajectories that incorporate gravity, air drag, and spin effects (Magnus effect). I envision an adequate person would be able to decipher the above article rather quickly, and estimate the time required to assist in the range of 4-12 hours. I would be willing to more than adequately financially compensate anyone that can help (assuming sufficient prior knowledge/experience). If you believe you can assist, or know someone who may be able to, please contact me as soon as possible. Regards, Paul
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!