Finding the line?

This topic is 4823 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

How do I find the line, in 2D, that a object is moving on, such as a pong ball. So from the velocity how do I calculate the line coordinates? I need it to figure out so I can tell where the ball will hit for the computer. I am terrible at math, I don't even know what this calculation is called, so I dont know what to look for on google or here. Can anyone lend me some help. Thanks.

Share on other sites
Quote:
 Original post by cptrnetHow do I find the line, in 2D, that a object is moving on, such as a pong ball. So from the velocity how do I calculate the line coordinates? I need it to figure out so I can tell where the ball will hit for the computer. I am terrible at math, I don't even know what this calculation is called, so I dont know what to look for on google or here. Can anyone lend me some help. Thanks.

It's called the slope. Rise over run. See the definition of a line that you were supposed to learn in 7th grade. If you want, there are 30 different forms of the equation here

Share on other sites
They never taught me how to find the slope from a velocity. If you don't want to be helpful just don't post, don't waste the space on the forums. I wasn't in the highest math class either, you know some people struggle. I have no idea what those calculations are on that page. Am I supposed to know what everything is? If I did why would I post on here? Can someone give me a retards version of what the poster above tried to give me. Im sorry Im not as gifted as you are.

Share on other sites
Quote:
 Original post by cptrnetThey never taught me how to find the slope from a velocity. If you don't want to be helpful just don't post, don't waste the space on the forums. I wasn't in the highest math class either, you know some people struggle. I have no idea what those calculations are on that page. Am I supposed to know what everything is? If I did why would I post on here? Can someone give me a retards version of what the poster above tried to give me. Im sorry Im not as gifted as you are.

Apart from your trolling, I'll just repeat that the slope is the velocity, which is 'rise over run', or dy/dx, or however else you want to call it.

You might try looking at formula #2 from the definition of the line web page. Since you should know all but one value (you know the starting coordinates and the slope called m), and I presume you know one of the ending coordinates (the row your paddle is on), it should be easy to figure out.

Share on other sites
I think you are better off doing things with vector math, as slope you can run into division by zero issues if your ball is going directly up/down.

Vector math really isnt too terribly difficult to get a grasp on, especially for 2D where you will rarely need to use cross products.

Share on other sites
Well, a good resource is Mathworld. Just type line in the search field and follow the first link. What you describe is a line-line intersection. You can look that up on Mathworld as well, but I doubt you'll find that as useful as what you'll find on this site. If you follow the link under resources above for Programming>>Math and Physics the first three topics under Physics Tutorials is a good place to start. Under Math you'll find an article on fast 2D line intersection. Under Programming>>Game Programming you'll find a tutorial using pong Game Programming 101 Part I.

That will get you started.

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 9
• 9
• 9
• 14
• 12
• Forum Statistics

• Total Topics
633288
• Total Posts
3011221
• Who's Online (See full list)

There are no registered users currently online

×