Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6799505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:51:23+00:00 2026-05-26T18:51:23+00:00

I have a slider, whose velocity I calculate via the difference between positions each

  • 0

I have a slider, whose velocity I calculate via the difference between positions each tick (this can sometimes be huge due to using it via a touch screen, so maybe I should clamp this at some arbitrary number to avoid some of these issues?)

I have a ball with a 3 dimensional direction vector and a velocity.

When the ball collides with the slider I invert its direction on the Z axis (going away from the slider) and then use the sliders velocity to manipulate its X (left <-> right) direction. so:

ball.direction.x += (slider_friction * slider_velocity)

Now the ball update is carried out as follows:

velocity = ball.velocity * time
ball.direction.normalise()
ball.position = ball.direction * ball.velocity

This seems to work great, except in some cases it seems to be very possible for any of the balls axis to equal zero, resulting in it never returning to the slider in some cases. What would be a good solution to this? And what would be a good way to handle the response with the blocks when it collides with them? Should it return to bouncing at right angles, or should it maintain reflecting with the same bounce modifiers applied by the slider? Also any other physics tips for this kind of projectile simulation would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:51:24+00:00Added an answer on May 26, 2026 at 6:51 pm

    Hmm, this is a nice problem; the thing is, a good solution (that is, one that looks and feels just like real physics) is by nature one that uses real physics. Luckily, most of the newtonian physics within this problem can be easily simplified. Pardon me if I get overly verbose, but physics tends to do that to you.

    enter image description here

    So, to define the problem, this is an elastic (as in, no energy is absorbed) collision between an arkanoid ball and a paddle. First of all, since you’ve obviously got the vertical motion down, I won’t concern myself with that. So what follows is all on the horizontal components of the collsions.

    The paddle transfers a certain amount of horizontal momentum to the ball (although, since this is Arkanoid physics, the paddle loses no momentum itself :P). This can be recieved in two ways — by making the ball spin, and by giving the ball some horizontal momentum (obviously, if the ball already has horizontal momentum or spin, the added momentum will be…well, added).

    delta momentum + delta angular momentum = momentum paddle gave

    Of course, it might be annoying to work with momenta, since you don’t really have to. I would asssume that the ball and the paddle have constant mass (that is, the ball does not suddenly become heavier, although you could easily work with that), because then you could factor the mass of each out of your momentum equations. So then,

    delta horizontal velocity + delta angular velocity = paddle velocity * mass of paddle / mass of ball

    To get an equation you could use out of this, you have to set how much of the momentum from the paddle would go into the spin, and how much would go into ball movement. For example,

    mass_factor = 2 # ratio between paddle and ball masses
    angular_factor = 0.3 # the amount of the paddle's movement which will go into the ball's spin
    
    # and now for the bouncy-bouncy
    
    ball.hVel += (1 - angular_factor) * paddle.hVel * mass_factor * friction or whatever
    ball.spin += angular_factor * paddle.hVel * mass_factor * friction or whatever
    ball.vVel = - ball.vVel # of course, its vertical velocity reverses
    

    This will be enough to set up a quasi-realistic bounce, but one nugget remains (which you don’t need to adress, but adressing it would make your Arkanoid amazing) — what happens to all that spin? Can the spin be used somehow for more interesting bounces?

    So, to recap, your spin is the speed at which the periphery of the ball is moving relative to the center. Thing is, whenever a spinning ball bounces against something stationary, its spin changes as well as its velocity. If a spinning ball hits a stationary surface, the bal gets a little “kick” in the direction opposite that of its spin (if spin is measured at the point of contact), and the spin will change.

    #Upon collision with a surface (assumed horizontal, with the ball above the surface)
    ball.hVel += -(ball.Avel * rate) # Where "rate" is the ratio which determines how much angular velocity decays with each bounce
    ball.Avel *= 1 - rate # So the angular velocity decays properly
    

    Since angular velocity is rotationally symmetric, you would just treat collisions at different angles (balls on walls, balls on ceilings) as rotations of this.

    Phew, that was unintentionally long-winded, and it is nowhere near complete, but it’s enough to answer your question IMHO.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a slider that can go between 0 and 1. The
I have a slider with 4 elements whose any of them has the class
I have image slider where images replace each other by timeout. I use jQuery
I have a slider with values ranging from 0 to 100. I want to
I have an slider animation but on clX.click event #close div hides before it
In my View I have a slider and a combobox . When I change
I have a StackPanel inside of a ScrollViewer. I have a slider that does
I am creating a portfolio page for m personal site. I have a slider
I am creating a portfolio page for m personal site. I have a slider
I have a Coda slider on one webpage (hand-crafted, not using the plugin, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.