A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: ball not moving smoothy

  1. #1
    Junior Member
    Join Date
    Jan 2010
    Location
    limassol, cyprus
    Posts
    6

    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);
    Last edited by brigadier90; 08-12-2012 at 07:57 AM. Reason: velocity, math, friction

  2. #2
    Eternal Newbie
    Join Date
    Apr 2006
    Location
    Bitter cold Hell of the crappy NW
    Posts
    392
    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
    If I am wrong, please just correct me and move on.. there is no need for all that pointing and laughing! ~MoN

  3. #3
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    higher the frame rate maybe?

  4. #4
    President PhobiK's Avatar
    Join Date
    Jan 2005
    Location
    Guatemala
    Posts
    918
    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.
    This is MC. His _parents sent him to stop() by the super market to buy some _root beer if he wanted to gotoAndPlay() with his friends at the park later.

    This is my Blog!... The gaming Process
    Please check out my site: Giddel Creations

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center