# Ball won't bounce off walls correctly. (Sticks instead)

I’m trying to get a simple physics game working that uses a ball. The ball needs to bounce off walls realistically. However, when the ball approaches any wall at a relatively small angle, it just sticks to the wall instead of bouncing off.

Is there any possible way around this? When going head on at the wall, the ball will bounce. It will also bounce all the way up until around 20 degrees or so, depending on the velocity.

Edit: I wanted to clarify this question a bit more. Here is a quick drawing of the problem:

I need the case on the right to not happen anymore. If I had to guess, I’d say that the collision logic has a bug in it where it tells objects to not have any velocity other than parallel to the normal if it’s going slow enough.

I’ve already tried setting up physics materials, using projectile motion, and tons of other stuff. I’m considering just writing my own physics implementation of this, but I’d really rather not since I feel like this should be a part of such a big engine.

Have you played around with physics materials? A bouncy one (Restitution = 1, friction = 0) should result in something that doesn’t ever stick to a wall.

Trust me, I’ve tried every conceivable combination of physics materials ranging from 0 to 99999999.

Hi,
You must enable Sweep for your movement. I’m not sure if you used blueprints to do this, but here is how you would have to set it up.

If you use the unreal physics you would have to look it up.

I’m not quite sure how you are using the ball but the physics material should work. A method of achieving this is to use a projectile movement and set bouncing on.

Hey did you ever fix this?

I could fix this problem by enabling sweep on your SetActorLocation Node. If you are using the unreal physics settings I would recomend to use velocity instead of SetActorLocation, in this case you can also add a Projectile Movement component to your actor to gain more control over the bouncing behavior.

What do you mean SetActorLocation? I use the Add Force, why would you make a ball roll with SetActorLocation? And when I add projectile movement component it doesn’t affect the ball much at all

Try to use set velocity since if you add a force you will not reset already applied forces while set velocity gives you the option to do so. The projectile movement comopnent will not change your basic system but simply add more options to define physics behavior. I did decide to use SetActorLocation since this way (and this is probably missing experiance on my end) I had more control over the server client replication.

Try to use set velocity since if you add a force you will not reset already applied forces while set velocity gives you the option to do so. The projectile movement comopnent will not change your basic system but simply add more options to define physics behavior. I did decide to use SetActorLocation since this way (and this is probably missing experiance on my end) I had more control over the server client replication.

Here’s what I used for the case of a ball mesh bouncing being moved by “Add Force” against a wall in zero gravity (ie: gravity turned off on the mesh):

On Component Hit event on the ball itself:

Where impulse or force would work. The Float multiplier from the impact normal would need to be adjusted depending on your use case - ideally it could be some ratio or factor of the current balls veloctiy.

Note this is only required for zero gravity casesI think

[Keywords: unreal engine, bounce, problem, stick, velocity, angle]

If you are using v4.21 and experience what is described above, check this:

There is a threshold value, probably for preventing bouncing from never ending.
(referred to as “simulation stability”)

Goto:

Project Settings → Engine → Physics → Simulation

There you will find “Bounce Threshold Velocity”.

Read the field’s tooltip and think about how low you can set it.

1 Like

oh my i f**kin LOVE you. I didn’t even know about the project settings physic simulation settings. 2 years of unreal and still so stupid. THANK YOU !!!