Free Fall Question

Posted by Makenshi on Stack Overflow See other posts from Stack Overflow or by Makenshi
Published on 2010-04-25T02:29:02Z Indexed on 2010/04/25 2:33 UTC
Read the original article Hit count: 327

Filed under:
|
|

ok im gonna try my best to explain my problem i have this program where u can select 5 balls when u select one you can take it with you while you have the mouse button pressed and its within the ball radius. The problem is that i need a way to make the ball go up when the user stop pressing the mouse button like he sent it to float in the air then make it fall down again i have one way to know the time,velocity and thus the acceleration but i dont know how to implement it... right now i have this void Circulo::caida(float velocidad,float tiempo) {

 if(this->posY >= 580)
 {
 this->posY = 580;
 this->vcaida = 0.0f;
 }
 else if(this->posY < 580)
 {
 //this->distancia=9.81f * 0.5f*tiempo*tiempo;
 this->vcaida += velocidad;
 this->posY += this->vcaida;
 }

}

with this like this it just falls and i cant make the effect i tried to explain... thank you i hope someone can help me >.< oh yeah im calculating the time like this just in case it helps

      difX=(x> evento.motion.xrel)? x-evento.motion.xrel : evento.motion.xrel-x;
      difY=(y> evento.motion.yrel)? y-evento.motion.yrel : evento.motion.yrel-y;

and im sending difY as the time variable

© Stack Overflow or respective owner

Related posts about student-question

Related posts about c++