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.
Hi,
I think I have the answer to your problem:
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.
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.
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):
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
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 !!!