Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

2D Parabolic Arc between dynamic A-B


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 ElganSayer   Members   -  Reputation: 101

Like
0Likes
Like

Posted 20 October 2012 - 10:21 AM

Hello,
I have a problem and I'm not smart enough to work out a solutions.

I want to achieve a throw, a bomb between two points, and so it travels as an arc from point A, to point B. Point B is known and the bomb must land on point B


if the distance between the two positions AB is dynamic and the horizontal distance changes, the vertical distance may also change.


How can we know the initial vertical velocity in which to throw the object to make it art exactly on to position B?

How can I calculate it so my bomb moves in an arc from whatever point A is, so that it hits point B in an ARC. I have no idea, using other istes this is what I tried, i tried at least...then realized I have no idea for how long to run the loop for, and have no idea how to hit point b exactly.

tagetTilePosition is a vector ( 0 , 0 )
double startX = bombPosition.x;   // initial position
double startY =  bombPosition.y;   //   of the object
float angle = 45.0f * Mathf.Deg2Rad;
const double g = 9.8;	   // gravity (meters/s^2)
double velocity =20.0;
double Vx = velocity * Mathf.Cos(angle);  // x (horizontal) component of velocity
double Vy = velocity * Mathf.Sin(angle);  // y (vertical)   component of velocity
 
Vector2 distance = ( bombPosition2 - tagetTilePosition );
 
  //guessing
  double endTime = ( distance.x + distance.y ) / velocity ;
 
  for(double wait = 1; wait <= endTime ; wait += 1f)
  {
  /*
   float v_v;
   double g = 9.8f
   float s;
   float t = wait;
  
   s = bombPosition.y;
   t = d / v_h
   v_v = (0.5f * g * (t * t) + s) / t;
   */
   double  t = wait;
   double x = startX + Vx * t;
   double y = startY + Vy * t - 0.5 * g * t * t;
   bombPosition.x = (float) x;
   bombPosition.y = (float) y;
  
  // bombPosition.x = centre.x += ( 60 * Mathf.Cos ( (float) wait )  );
   //bombPosition.y = centre.y -=  ( 60 * Mathf.Sin ( (float) wait)  );
  
   bomb.transform.position = bombPosition;
  }


Sponsor:

#2 Bacterius   Crossbones+   -  Reputation: 3558

Like
2Likes
Like

Posted 20 October 2012 - 10:25 PM

Assuming gravity is the only force on the bomb, and is strictly downwards, and that point and compare them with whatever energy your bomb cannon has to select the correct one, if you wanted to get really fancy.

N.B. This can be generalized to any gravity vector and to higher dimensions by modifying the kinematics accordingly, but for the sake of simplicity and without loss of generality, only gravity in the vertical direction for the two-dimensional case is considered.

Edited by Bacterius, 20 October 2012 - 10:34 PM.

"The best comment is a deleted comment."
website · blog

[maintenance in progress]


#3 Bacterius   Crossbones+   -  Reputation: 3558

Like
2Likes
Like

Posted 04 November 2012 - 09:22 PM

For completeness, I provide the fully generalized version in this post (since I guess someone will eventually ask). Let , you can use the same methods as above, which involve another double integral. However at this point, the problem essentially boils down to finding a parameterized intersection of two differential curves, which might be better tackled by other methods involving more specialized forms of calculus.

Edited by Bacterius, 05 November 2012 - 12:22 PM.

"The best comment is a deleted comment."
website · blog

[maintenance in progress]





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS