Ball flys through racket - how to avoid that

have a racket and a ball. bouncing works good.
but sometimes the ball flys through the racket.
how to avoid that?

How are you currently doing it? Physics? Your own collision detections and handling?

If physics, try setting the Bullet box in the Physics behaviour setting screen.

If it’s not physics, then post a screen shot of the events.

Your problem may be that the ball object is travelling so fast that it passes through the paddle within a frame.

You may instead need to fire a raycast from it’s current position to it’s previous position, and reverse the ball’s current velocity (and reposition it) if there’s a paddle in between the two positions.

It’s a bit messy, unfortunately, byt there isn’t much else I can think you can do. Your alternative is to use physics behaviour with the bullet setting on the ball object.

Unless someone has a better idea.

what does this mean?
how to?

It means you add the physics behaviour to both the paddle and balls. However, then the movement changes completely, and things get complicated.

You could try increasing the size of the collision box on the paddles so it’s wider than the actual image (you may need to attach a large but hidden object to achieve this).

ive already done this but it does not help.
a bigger collisionbox doesnt look good.
what about an obstacle-setting? (dont know how to set that)

But you’re not using it from what you’ve given in the snip of your events. If you use Physics, then you don’t need to check to collision and change the ball direction using the bounce extension - it’s all taken care of by the physics behaviour.

You can’t see collision boxes, so I’m not sure what you mean by that.

1 Like