How do I Predict Volleyball bumps

Get help using Construct 2

Post » Sat Mar 18, 2017 5:36 am

I was thinking of making a wacky Volleyball game of some nature. I was fooling around with physics and then the bullet behavior and didn't think they were the right solution for what I would like. I believe I need more control over where the ball bounces for bump passing to your team mate.

Could I get some help to send me in the right direction on what math I need to implement for something as described in my image attachment? I would like to understand how a to get the ball to arc towards a destination and have the weight of a volleyball.

Image
B
43
S
14
G
3
Posts: 288
Reputation: 8,866

Post » Sat Mar 18, 2017 9:21 pm

This might help.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Sun Mar 19, 2017 12:12 am

Thank you for the link randomly but r0j0hounds links are dead. I saw that article but unfortunately the capx's files are toast.
B
43
S
14
G
3
Posts: 288
Reputation: 8,866

Post » Sun Mar 19, 2017 4:06 am

I'm not sure that link would help.

You can do the projectile motion by giving the ball two variables: vx and vy
Then the motion is done with one event:

Global number g=100

Every tick
--- ball: add g*dt to vy
--- ball: set y to self.y+self.vy*dt
--- ball: set X to self.x+self.vx*dt

g is the gravity value. Next you can do bouncing with:

Ball overlaps head
Ball: vy>0
--- Ball: set vy to -self.vy
--- ball: set vx to g*(otherhead.x-self.x)/(-2*self.vy)

So that will make the ball bounce back up to basically it's original height and vx is set so the ball will land on some other head.

That formula can be found by using these two projectile motion equations:
Y=y0+vy*t+0.5*g*t^2
X=x0+vx*t

Just solve for vx with the simplification of y=y0. Solve it without the simplification if you want the ball to land on different heights.

On a final note, you can make the height the ball bounces back to by changing the "set y" action to:
Ball: set y to self.y+self.vy*dt+0.5*g*dt*dt
And moving the set vy action below it.
B
92
S
32
G
110
Posts: 5,298
Reputation: 71,507

Post » Sun Mar 19, 2017 8:39 am

Part of the beauty of physics is it responds naturally to collisions which has some unpredictability in real life.

In most voleyball games I have played the physics are actually over rode and when you locate your player under the ball you use some other form of control like crosshairs to bump the ball towards another player or position.

I would use something like the trajectory control in angry birds or a cross hair with X and Y vector so the player can see where the ball will be bumped to on the field or to a player.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790

Post » Sun Mar 19, 2017 8:20 pm

R0J0hound thank you for spending the time to write such a thorough explanation. You have consistently been a great help over all the years.

lamar thanks for the great suggestions.
B
43
S
14
G
3
Posts: 288
Reputation: 8,866

Post » Sun Mar 19, 2017 10:45 pm

B
43
S
14
G
3
Posts: 288
Reputation: 8,866


Return to How do I....?

Who is online

Users browsing this forum: ametueraspirant, dand, Maydie, mickclarke and 29 guests