How do I create a ball bounce by angle effect?

Get help using Construct 2

Post » Sun Nov 23, 2014 4:06 pm

Hey all,

Suppose I have a moving box/platform in which a ball hits. I'd like the get the "ball bounce" behavior, where the ball moves more to the right if hit on the right side of the platform, or left if hit on the left part of the platform (or balance itself if it was moving right initially).

I've seen the breakout tutorial here: https://www.scirra.com/tutorials/313/cl ... kout-video, but I'm looking for a physics behavior method of doing this, not a bullet one. Just like bouncing a ball on the head.

How do I start calculating such a behavior?

Thanks! :)
B
18
S
7
G
1
Posts: 160
Reputation: 1,934

Post » Sun Nov 23, 2014 5:18 pm

Either use bullet behaviour with gravity in it (simplest) or use physics behaviour.
You can use math as well with "on collision" and dynamic angle.
B
10
S
1
Posts: 56
Reputation: 654

Post » Sun Nov 23, 2014 6:52 pm

@funkyy, I've tried using physics with apply impulse on it, the problem with physics, is that hitting corners makes it go crazy, which I don't want. I only want the nehavior to apply when jumping on the the platform, and not the corners.
B
18
S
7
G
1
Posts: 160
Reputation: 1,934

Post » Sun Nov 23, 2014 6:58 pm

Hi @funkyy it looks like @trueicecold is looking for the physics behaviour to me.
Image
B
9
S
3
G
1
Posts: 346
Reputation: 1,560

Post » Sun Nov 23, 2014 7:16 pm

yeah, I'm looking for that "curve" when the ball reaches the top and starts to descend, that can't be achieved with bullet (at least I don't think it can). In addition, putting gravity on the bullet, means it'll gradually lose bounciness, which I don't want.
B
18
S
7
G
1
Posts: 160
Reputation: 1,934

Post » Mon Nov 24, 2014 3:42 am

You could try this:

Don't give the paddle the physics behavior.

on ball collides with the paddle then
apply impulse up on the ball
and
apply a horizontal impulse depending on where on the paddle was hit.

Like this
(ball.x-paddle.x)*k
where k is a number to adjust the strength of the impulse.

Then all that's left is to choose numbers that give acceptable results.
B
94
S
33
G
114
Posts: 5,357
Reputation: 73,775

Post » Mon Nov 24, 2014 3:22 pm

Thanks a lot @R0J0hound!! Adding impulse Y at -2 did the trick, as well as the impulse X with the calculation :)
Also, removing the physics from the player (paddle) fixed the cornering issue :)

Thanks a lot!
B
18
S
7
G
1
Posts: 160
Reputation: 1,934

Post » Wed Sep 20, 2017 11:34 am

I love you @R0J0hound, I was stucked for a entire day with this in CC
B
6
S
1
Posts: 33
Reputation: 468


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot] and 30 guests