Calculating Bouncing Velocity from Tangent Angle in 2D Collision

  • Thread starter hadyn
  • Start date
  • Tags
    Reflection
In summary, the problem is that the ball's velocity (x and y) and angle (tangent) need to be set to create a desired reflected trajectory.
  • #1
hadyn
3
0
Hello there,

Let me start by saying this question is going to make me look somewhat ridiculous considering the complexity of most other questions floating around here, but I'm not a maths or physics student and never have been; rather I'm a graphic designer with a basic query in relation to a game I'm making in flash. That said, forgive me if I don't use the right terminology, so far I'm more or less entirely self taught in what basic physics I know.

So here's the problem:

I have a ball moving in 2D with independent x and y velocities. That ball collides with a curved shape - when this happens, I'm able to find the tangent at which it collides - the effect I want to achieve is simply of the ball bouncing from that tangent in the correct reflected direction (with no concern for fricition, gravity or anything like that).

So, for example, say the ball's x velocity is 4 pixels per second and the y velocity is 2 pixels per second (flash is upside down, a positive y value actually implies downward movement), and it hits the curve at a 35 degree tangent - how do I find what the new x and y velocities should be?

I've been working on this all night and I've come quite close - using various sine functions I was able to at least make the ball retain the same overall velocity when it bounced, but I can't for the life of me get it to bounce in the right direction and I'm not sure why, so I figured it'd be pointless showing you guys my code which doesn't work if someone can simply offer a method that does.

In short:

I have the x and y velocities (and therefore the overall speed and direction) of a ball and the angle of the tangent at which it hits a curve. I need to set new x and y velocities to make it appear to have bounced off naturally - how?

Thanks heaps for any help,
Hadyn
 
Science news on Phys.org
  • #2
hadyn said:
In short:

I have the x and y velocities (and therefore the overall speed and direction) of a ball and the angle of the tangent at which it hits a curve. I need to set new x and y velocities to make it appear to have bounced off naturally - how?
Since you have the angle that the velocity makes with the tangent, try this. Find the components of the velocity parallel and perpendicular to the tangent. During the collision, the parallel component will remain unchanged but the perpendicular component will be reversed.

You'll have to work out the details of converting back and forth between x&y and parallel & perpendicular. Should be straightforward.
 
  • #3
Whilst I'm slightly confused by some of those terms, that at least sounds pretty much like what I've been trying, but I still don't know the exact methodology. It's not really a case of being able to work it out, it's a case of simply not knowing how to use the tools available (sine functions, etc).

Assume I know very little about math. It's been years since high school and beyond the most basic use of Pythagoras I've more or less forgotten everything I'd learned. Before reading up on it yesterday, I had no idea how any of those angle functions worked, and because it's such a new concept and I've already got my brain full of other new concepts in terms of hit detection and other code I've been writing, I just... can't figure it out. I'm willing to admit I've gone completely brain dead. Not only that, but I've probably tried too many different things to get it working now that what I have is way too complex and confusing and relies on too many variables, any of which could potentially be wrong.

At the very least I've been able to make my application draw three lines: the trajectory when it hits, the tangent, and the desirable reflected trajectory... so I'm assuming that means my angles are okay - I just can't seem to get the proper new x and y velocities so that it actually takes up this new trajectory.

I'm more or less asking for an exact methodology, if you can. I'd love to be able to work this out for myself, but without knowing how it's done at all I feel lost.

Thanks heaps,
Hadyn
 
  • #4
Nevermind, I'm proud to announce I fixed it. What I had was right, it's just that one of my angles was inverted so it was acting weird... It works perfectly now. Cheers for the advice.
 

FAQ: Calculating Bouncing Velocity from Tangent Angle in 2D Collision

What is a simple reflection question?

A simple reflection question is a question that prompts an individual to think about a specific experience or situation and reflect on their thoughts, feelings, and actions related to it.

Why are simple reflection questions important in scientific research?

Simple reflection questions are important in scientific research because they allow researchers to gather qualitative data about individuals' experiences and perspectives. This data can provide valuable insights and help researchers understand complex phenomena.

How can simple reflection questions be used in data collection?

Simple reflection questions can be used in surveys, interviews, and focus groups to gather in-depth information about an individual's experiences or opinions. They can also be used in self-reflection exercises to gather personal insights.

What are some examples of simple reflection questions?

Examples of simple reflection questions include "What thoughts came to mind when you encountered this situation?", "How did you feel about this experience?", and "What actions did you take in response to this event?"

How can simple reflection questions be used to improve scientific research?

Simple reflection questions can be used to improve scientific research by providing a deeper understanding of participants' perspectives and experiences. This can help researchers develop more accurate theories and make more informed decisions based on the data collected.

Back
Top