-
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);
-
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
-
higher the frame rate maybe?
-
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.