Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Not understanding the physics of moving particle?  (Read 1824 times)

0 Members and 1 Guest are viewing this topic.

AndreeU17

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Not understanding the physics of moving particle?
« on: May 17, 2014, 06:58:30 pm »
I don't understand how to apply a moving ball? I've kept reading an most people apply physics, the phytagorean theorem and as we'll as sine, cosine & tangent! But I don't understand why we need to use that? How can I get a smooth animation ball that moves to whatever position in the window?

Could someone link me or show me reference or how mathematically it works? I can do the coding on my own

Thanks

Geheim

  • Full Member
  • ***
  • Posts: 201
    • View Profile
    • Email
Re: Not understanding the physics of moving particle?
« Reply #1 on: May 17, 2014, 07:15:41 pm »
Depends on what movement you want to have? A linear movement from A to B? Then just move your ball with the move function.
If you want to move the ball where your mouse is, if you click, you need to get the correct vector first (with very simple math (B - A) and then normalize it, so you always move with the same speed.

Maybe you can specify more on what you need exactly?
Failing to succeed does not mean failing to progress!

AndreeU17

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Not understanding the physics of moving particle?
« Reply #2 on: May 18, 2014, 03:27:41 am »

Depends on what movement you want to have? A linear movement from A to B? Then just move your ball with the move function.
If you want to move the ball where your mouse is, if you click, you need to get the correct vector first (with very simple math (B - A) and then normalize it, so you always move with the same speed.

Maybe you can specify more on what you need exactly?

I want movement in a linear way in any direction, from 1 point to the other, etc. I'm recreating my own version of Pong & I figured out how to get the ball
Moving already but my problem
Now is getting it to collide with a paddle and bounce back

Wrapperup

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Not understanding the physics of moving particle?
« Reply #3 on: May 18, 2014, 04:43:55 am »
If you are applying a constant velocity (or moving the ball every update), invert the axis that it bounces off of.

Hits a wall on the left, inverts x to go right, gets the ceiling, inverts y to go down and so on...

For detecting collision, there is a collision class, just google it up  :)

 

anything