0
votes

I have a paddle and a ball (SKSpriteNodes) that are both affected by gravity. The paddle has a jumping effect to hit the ball.

The issue I'm having is when the paddle hits the ball, it absorbs some of the ball's energy and bounces back. The paddle needs to be unaffected by the ball's contact, but remain affected by gravity.

paddle.physicsBody!.affectedByGravity = true
paddle.physicsBody!.restitution = 0

ball.physicsBody!.affectedByGravity = true
ball.physicsBody!.restitution = 1.0

physicsWorld.gravity = CGVector(dx: 0, dy: -9.8)

enter image description here EDIT: This is the point of contact. The paddle jumps to the point of the ball, is normally affected by gravity, but receives a little downward bounce effect from the ball hitting it.

1
Show us a screenshot when the paddle hits the ball.WangYudong
Have you tried to set a greater value for the paddle's mass? If It doesn't work, add all the code that can reproduce your issue, and I will have a look.WangYudong
That seems to work, but the ball bounces too high. Should I reduce the balls velocity at the time of contact?mnort9

1 Answers

0
votes

If adjusting the paddle's mass seems to work, but will have some side effect, you may want to decrease the ball's restitution first. To reduce the ball's velocity is also a workaround.