A Flash Developer Resource Site

# Thread: ball not moving smoothy

1. ## ball not moving smoothy

Hello Guys,

So what i have is a very simple ball moving on a surface with friction, the ball has a vx and vy component. i get the ball to move and slow down with friction and it works fine. However, as the ball approaches 0, i start to notice what appears to be a wobbly effect (i.e: it starts to deviate left and right from its path). Ultimately it follows its line, but its as if it moves in ad out of it towards the end. Here is the math behind my ball's movement:

Friction = 0.2;

v -= friction;
vx = v * cos(theta);
vy = v * sin(theta);

2. Just a thought, and I really have no idea as I haven't done much with friction, gravity etc, but it sounds like as if the ending is making the math numbers to be smaller and become partial which effects the x and y over all (instead of being whole numbers or tenths, etc.) Perhaps adding a round up or round down to the nearest 10th would help?

~MoN

3. higher the frame rate maybe?

4. Why don't you go with something like v *= 0.9;? Can't really see the problem without watching the real thing but if you don't set a limit then when it reaches 0, the speed will turn negative. If you go with the *= friction way it'll never go past 0, and looks natural in my opinion. Also, is the "theta" variable converting the angle from gradians to degrees? That can affect too.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

 » Home » Movies » Tutorials » Submissions » Board » Links » Reviews » Feedback » Gallery » Fonts » The Lounge » Sound Loops » Sound FX » About FK » Sitemap

Click Here to Expand Forum to Full Width