영어로 쓸태니 잘 읽어보세요
/* Variable deions
* yVelocity //ball\'s y velocity
* xVelocity //ball\'s x velocity
* initialY //where to start, in ur case which is going to be pillar\'s height + ballHeight
* friction //optional, you can make yvelocity friction if you want more 3Dlized physics onto ur ball
* time //ofcourse you will use ur thread to measure time. Instead you also can make ur choice to use System.currentTimeMillisec() for time
* yLimit //when ball\'s to change it\'s state = state [going down, going up];
*/
==================== Case when ball going down ================
timer+=1;
yVelocity = initialY + .5*gravity*(time * time);
//gravity can be replaced by friction
//and here you need condition statement to check when ball is about to change its state to bouncing
================case when ball bounces ==========================
//quick little code to check its initial speed, not compilicated huh
//also final pos is where u have changed ur ball\'s state, which is yVelocity its own at that certian time n position
initialSpeed=decay*Math.sqrt(2*Math.abs(finalPos-initialPos));
timer=0;
currentY = yVelocity
time+=1;
//Storing the position of the ball before and after it moves
int positionA =yVelocit;
//again gravity can be replaced by friction but u have to try it out
yVelocity = currentY - initialSpeed*time + .5*gravity*(time * time);
int positionB=yVelocity;
and to move ur ball to make it look like bouncing to forward, just give xVelocity += speed or some sort, simple.
it cannot be any simpler than this.
peace.
또한 time, pos, gravity (friction), speed등이 table로 기록되게 되있다면 variable을 간단하게 그 value가 되게 바꾸면 끝
yus
just to let\'s u know that this is only a my own way of doing this, u got millions of other ways u could possibly incooporate with but i found this works the best. even tho u can apply this stuff onto openGL for 3D stuffs
good 헤헤