Sign in to follow this  
ajm113

Return Global Position From A Origin Of A Object X axis? (2D)

Recommended Posts

Right now I am making a simple Pong Game Using Simple Math using C++ and OpenGL. Right now lets say the paddle is a at. 0.432 Y. This is the paddle origin. So I want the block on the side of the paddle too be 0.2 block length. So how can I get the positions of the blocked area through the origin so when the ball's X position goes through a if statement and I get the paddle's Y position it will determine the block area is with the paddle by it's origin. So if the ball interacts with the paddle the ball will simply revers. I haven't learned much Algebra so please be detail if you can. Thanks, Ajm113. [Edited by - ajm113 on March 21, 2008 1:17:21 AM]

Share this post


Link to post
Share on other sites
Your question is not at all clear. Can you try to rephrase it so that it's obvious what you're asking? It would appear that you're asking how to perform collision detection, but that doesn't have anything to do with the title of the thread, so I'm confused.

Share this post


Link to post
Share on other sites
Image and video hosting by TinyPic

So lets say the ball gets into the X axes where I want to check, but since I don't want too give the ball collision, but only use simple math by using object origins and determine what should happen in a position in a specific axis. So if the bat was in the same X origin by Y of the bat moving up or down was maybe a bit higher or lower then the incoming ball. It would detect the width's positions of the bat to determine if the ball will go backwards instead of the ball going through the bat.

It is collision detection, but also I want to know how can I determine a area of where the bat is at by Y axes and by the paddle width the ball should return or not when the ball gets at a specific X axes where a if statement will check and see if the ball would return to player 2 again.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this