Correct me if i am mistaken but a slingshot can already generate a parabolic movement in box2d physics. In @ar2rsawseen 's example just the world is limited with walls so you can not see the parabolic movement with those parameters. In order to see it just decrease the strength parameter(it is by default 1.0 in the example make it 0.4 or 0.5 you will see) a little bit and slingshot the ball up with some angle. You will notice that a parabolic movement is automatically generated hence you are applying both x and y vector forces to the ball object. Because there is gravity also set in box2d, automatically a parabolic movement will be generated when the speed of the ball decrease. (You can also increase the friction a little bit)
Yes, I was playing with the strength value and also I have to take into account the ball density, friction and restitution parameters. Another option is to set a higher value for the gravity. But it's not easy for me to achieve the best parabolic movement.
Btw, do you know any way to draw the trajectory with a curve or broken line?
Comments
In @ar2rsawseen 's example just the world is limited with walls so you can not see the parabolic movement with those parameters.
In order to see it just decrease the strength parameter(it is by default 1.0 in the example make it 0.4 or 0.5 you will see) a little bit and slingshot the ball up with some angle. You will notice that a parabolic movement is automatically generated hence you are applying both x and y vector forces to the ball object.
Because there is gravity also set in box2d, automatically a parabolic movement will be generated when the speed of the ball decrease. (You can also increase the friction a little bit)
Yes, I was playing with the strength value and also I have to take into account the ball density, friction and restitution parameters. Another option is to set a higher value for the gravity. But it's not easy for me to achieve the best parabolic movement.
Btw, do you know any way to draw the trajectory with a curve or broken line?
Thanks.
https://play.google.com/store/apps/developer?id=SimplesApps
http://www.amazon.com/gp/mas/dl/android?p=com.simplesapps.actionbasket
https://itunes.apple.com/artist/david-rodriguez/id763996989
For the trajectory curve, look to this http://giderosmobile.com/forum/discussion/2826/show-path-of-physics/p1
It is not lua but box2d. So just needs to be converted thats it.
I've converted to lua and it's working almost the majority of the times.
I guess it's hard to get it to work perfect.
https://play.google.com/store/apps/developer?id=SimplesApps
http://www.amazon.com/gp/mas/dl/android?p=com.simplesapps.actionbasket
https://itunes.apple.com/artist/david-rodriguez/id763996989