# How do I calculate drag/bend on a soccer ball

0 Favourites
• 5 posts
• First of all, I don't know if "drag" is the correct term in this case, my english is not that good.

I'm trying to make a 2d top-down "Free kick" soccer game (see New Star Soccer). Where depending where you hit/kick the ball will determine the angle and force applied to the ball, including drag or effect on it, it's time on the air, etc.

You can (more or less) see what I'm talking about in this video

I've tried using different approaches but none of them feels right. I'm about to test using freel fall equations on y axis to calculate the flight time of the ball given certain force and angle, but the problem is the effect on the ball, I've been thinking about using the same free fall equations but with a different gravity (much smaller than 9.8). Haven't tested this.

I've tried using sin behavior to a certain value, so it goes up and continues to go down until the ball stops, but it just doesn't feel right. I think theres the qarp interpolation to simulate something like this, but don't really know how to use it, because in the examples I've seen (all by R0j0) he's using another set of x,y positions.

I could keep writing about all the ways I can think of making it work, but maybe I'm just too focused on the problem right now that I can't just see a clearer path to tackle this.

Anyways, hope you cguys can help.

• I believe it's using "leap" which is designed by R0J0hound

You have to create your own design according to angle direction and force according to width of arrow, to target position you can multiply from width of arrow, when it's ready to simulate, call leap function, you can modify this function while comparing "t" as instance variable to make it bounce and force would be divided by 2, to stop bouncing 2 times, use boolean to set isBounced.

I hope it helps you

• Ok, I'm going to take a look at it and let you know how it went, thanks Joannesalfa

Edit: After looking at the example and reading your post a few times I finally understood. I was able to simulate more or less the same thing, what I'm having trouble to do is the effect on the ball.

Let's say the player is shooting up (north), I still need to simulate the effect of the ball on the x axis if the player made it's shoot with effect to avoid the wall of defense in front of the player covering the goal, so the player can't shoot directly to goal.

I need to bend the the direction of the ball so it curves in mid-flight.

• I've amended R0j0hound's wonderful qarp example here from the following thread: https://www.scirra.com/forum/how-do-i-make-parabolic-projectile-and-movement_t103232.

Is this something like what you're after?

You can drag and drop the red 'X' then aim the ball anywhere and it will curve towards the 'X'.

Attached requires C2 r173 or greater.

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• zenox98 thanks, It's 3:30 am here, so I can't relly make tests with your capx but, I wll take a better look at it tomorrow. I'm thinking about moving the "target" depending on the strength and angle of the shot. I tried using qarp but I'm no math magician as R0j0hound but your capx gave me some ideas, I'll make some test in the morning and let you know how those went.

Thanks!