Page 1 of 1

How to make: Visual ping pong ball with sound or polyrithms

PostPosted: Wed Jan 17, 2024 2:05 pm
by mayo
Hello,

dont you have idea how to create this exactly? (example video below) visual+sound, which software to use? Is it possible easily in Flowstone or you suggest some other software? (need it for one music visual project, thanks a lot)

Here is example:
https://www.facebook.com/reel/756111399756982

Re: How to make: Visual ping pong ball with sound or polyrit

PostPosted: Wed Jan 17, 2024 10:45 pm
by billv
Thank God I'm not alone!. For several years I was obsessed with how to make a bouncing ball
in FS. I always failed, because you need to create some sort of physics engine. :?
A physics engine is my number one dream for FS, opening the door for some serious Game development. 8-)
I use software called "Fusion", is a perfect example of how a physics engine in FS should behave...with shitloads
of user control options. Right now I'm be happy with a box with a bouncing ball inside...any Guru's out there
looking for a challenge?? :?:
Thanks

Re: How to make: Visual ping pong ball with sound or polyrit

PostPosted: Thu Jan 18, 2024 1:45 am
by tulamide
mayo wrote:Hello,

dont you have idea how to create this exactly? (example video below) visual+sound, which software to use? Is it possible easily in Flowstone or you suggest some other software? (need it for one music visual project, thanks a lot)

Here is example:
https://www.facebook.com/reel/756111399756982

Exactly? No.
If you don't need the trail of past circles, it isn't difficult to do in Flowstone, though. Too much to explain in short, I'm afraid.

Re: How to make: Visual ping pong ball with sound or polyrit

PostPosted: Thu Jan 18, 2024 2:00 am
by tulamide
billv wrote:Thank God I'm not alone!. For several years I was obsessed with how to make a bouncing ball
in FS. I always failed, because you need to create some sort of physics engine. :?
A physics engine is my number one dream for FS, opening the door for some serious Game development. 8-)
I use software called "Fusion", is a perfect example of how a physics engine in FS should behave...with shitloads
of user control options. Right now I'm be happy with a box with a bouncing ball inside...any Guru's out there
looking for a challenge?? :?:
Thanks

I did this once, at it isn't very difficult to be honest. First you set up gravity. It means a direction where the circle is pulled to contantly. For example to the bottom. Let's just set our gravity to 4 pixels per second.

You loop-call a method that applies 4 pixels per second (via deltatime) to the direction "bottom".

-method gravity
dt = t - time
t = time
circleforcebottom += 4 * dt
end method

With this alone, when placing a circle at the top of the screen, it will gain velocity and move gradually faster and faster towards the bottom.

Combine this with a "ground": an immovable object that will decelerate motion to zero, if no bouncing force exists. If it exists, you add the bouncing force to the circle, and it will accelerate towards the top, until the gravity moves it down again. Friction is defining the material of the "ground". When the circle moves on the ground, this is the amount by which it will slow down - it loses momentum. And lastly: angle of incident = angle of emergence. If the circle hits the "ground" at 30°, it will leave it at mirrored 30°. The curve it will take builds automatically from the applied gravity force.

And so on. Really, it isn't very difficult, once you start it. It is just very time consuming.

Re: How to make: Visual ping pong ball with sound or polyrit

PostPosted: Thu Jan 18, 2024 2:25 am
by RJHollins
Love it when you explains things Tulamide !

Thanks.

Re: How to make: Visual ping pong ball with sound or polyrit

PostPosted: Sun Jan 21, 2024 12:15 pm
by mayo
tulamide wrote:
billv wrote:Thank God I'm not alone!. For several years I was obsessed with how to make a bouncing ball
in FS. I always failed, because you need to create some sort of physics engine. :?
A physics engine is my number one dream for FS, opening the door for some serious Game development. 8-)
I use software called "Fusion", is a perfect example of how a physics engine in FS should behave...with shitloads
of user control options. Right now I'm be happy with a box with a bouncing ball inside...any Guru's out there
looking for a challenge?? :?:
Thanks

I did this once, at it isn't very difficult to be honest. First you set up gravity. It means a direction where the circle is pulled to contantly. For example to the bottom. Let's just set our gravity to 4 pixels per second.

You loop-call a method that applies 4 pixels per second (via deltatime) to the direction "bottom".

-method gravity
dt = t - time
t = time
circleforcebottom += 4 * dt
end method

With this alone, when placing a circle at the top of the screen, it will gain velocity and move gradually faster and faster towards the bottom.

Combine this with a "ground": an immovable object that will decelerate motion to zero, if no bouncing force exists. If it exists, you add the bouncing force to the circle, and it will accelerate towards the top, until the gravity moves it down again. Friction is defining the material of the "ground". When the circle moves on the ground, this is the amount by which it will slow down - it loses momentum. And lastly: angle of incident = angle of emergence. If the circle hits the "ground" at 30°, it will leave it at mirrored 30°. The curve it will take builds automatically from the applied gravity force.

And so on. Really, it isn't very difficult, once you start it. It is just very time consuming.



Wow thank you, any chance you can post some example here?

Btw. I know way how to make some crazy money with this :lol: not joking really
if you want to cooperation

Thanks

Re: How to make: Visual ping pong ball with sound or polyrit

PostPosted: Wed Feb 07, 2024 9:10 am
by billv
mayo wrote:any chance you can post some example here?

Yes... a working example would be great...as I still can't work it out... :?

Re: How to make: Visual ping pong ball with sound or polyrit

PostPosted: Wed Feb 07, 2024 11:38 am
by tulamide
I don't have the time to do it. But here's an interactive example. The code is on the right (Javascript - JS, very similar to Ruby)

https://codepen.io/AlexRA96/pen/egaxVV

Re: How to make: Visual ping pong ball with sound or polyrit

PostPosted: Thu Feb 08, 2024 4:36 am
by billv
tulamide wrote:The code is on the right (Javascript - JS, very similar to Ruby)

Thanks Tulamide ....I'm looking into it..
I found this online...might help
Code: Select all
# Define the Ruby Component class
class BouncingBall < RubyComponent
  # Initialize the component
  def initialize
    # Define instance variables for ball position and speed
    @ball_x = 320
    @ball_y = 240
    @ball_speed_x = 5
    @ball_speed_y = 5
    @ball_radius = 20
  end

  # Update method to move the ball and handle collisions
  def update
    @ball_x += @ball_speed_x
    @ball_y += @ball_speed_y

    # Check for collision with window edges
    if @ball_x + @ball_radius > getWidth || @ball_x - @ball_radius < 0
      @ball_speed_x *= -1
    end

    if @ball_y + @ball_radius > getHeight || @ball_y - @ball_radius < 0
      @ball_speed_y *= -1
    end
  end

  # Draw method to draw the ball
  def draw
    fill_ellipse(@ball_x - @ball_radius, @ball_y - @ball_radius, @ball_radius * 2, @ball_radius * 2, "red")
  end
end