Physics - Bouncing Ball from Walls

I’m working on a prototype that involves bouncing a rolling ball from walls like bumpers at a bowling alley. What would be the best way to apply physics, such as making a ball bounce from a wall when it hits at a certain angle? Or when it hits a slanted wall? Please include examples, too.

Here is a clip for visual aid. Though I have also noticed the ball doesn’t always go straight as it’s supposed to. The ball has a collision sphere around it and I thought I gave the ramp a collision box of its own. What would be the best way to make the collision box to ensure the ball rolls straight downwards?

There should be a component in unreal that is built into either the projectile function that replicates the bouncing that you want possibly.

1 Like

After looking over the 3D model I downloaded, I noticed the ball was not perfectly round. So I replaced that with a sphere from the StarterContent folder instead.

I tried to add the Projectile component to the sphere within the actor, but I couldn’t make it a child of the sphere rather than the whole ramp. (see image below)

Then, whenever I try to do a test, this happens!


So I have no idea what’s going on, but I’m pretty sure I’m doing something wrong when I added the Projectile component. I could make a separate sphere actor, except I can’t seem to cast to it when the Space Bar is pressed. (That’s what’s supposed to enable Simulate Physics.)

What it looks like you did was add the projectile component to the entire object, you would want the projectile component only on the thing that is the projectile. For example create a bp with your object, and when your thing throws/rolls/what ever it does just make the thing attached to the arm or whatever it is invis temporally spawn the projectile at X location and then let it roll. lemme know if that helps at all

I tried to make a separate actor BP of the ball, but it makes a capsule collision box automatically. I wanted to replace that with a sphere one, but I can’t delete the capsule collision. Unless there’s a way to make an actor BP without making a collision box?

If the actor itself is a skelly mesh then it generates its own physics mesh, if your trying to make a mesh that you can control that isnt a capsule, you can change the capsule size in the bp

1 Like

You know, I completely forgot I could do that. So I’ll just have to scale the capsule down until it’s as round as the sphere.

I just tried adjusting the size of the capsule, but it also affects the sphere. So there’s still a collision capsule.

your scaling the entire thing, scale the capsule only.
right below where it says capsule half height and radius.

1 Like

Okay, so I managed to fix the capsule by scaling and moving it separately from the sphere. I also gave it the Projectile component and currently that is set as below.

But now, when I try to test the ball, this happens:


This seems more complicated than I thought. I wonder if I should just make a ramp with architectural objects for now.

Remember that the ball itself is now a projectile, so you must take the ball and lower the velocity. also when you start the game the ball will auto go since it has velocity, thats why when you spawn it it flys to who knows where

I just tried unchecking anything velocity-related and reducing velocity-related numbers to 0.0, and the ball still falls through the floor.

Enable collision presets, and also physics if need be.

Also check if your mesh itself as the proper collsion presets, for example if you go into the mesh itself does it say project default at the bottom somewhere and just swap that to use complex collison as normal exc exc

Right now, the program is set to simulate physics for the sphere only when the space bar is pressed.

As for the second part, are you referring to this, on the left and right sides of this screenshot?

Also, I inserted a sphere, as opposed to a static or skeletal mesh.

this is what im talking about, the bottom part of the mesh that you are throwing the ball against. assuming that you are hitting a custom mesh, is it using the complex collision as simple? Im assuming that it is using project default in your thing since thats what all projects basicly do. which is annoying, also your thing that lets it slide down is that a static mesh? or skelly? if its a skelly mesh then the issue is that it has its own physical mesh and its just possibly flinging the ball to god knows where.

Also going through the logs of this chat, ive also noted mentally that you should prolly use a move component to location or if you need to use an animation and then just hide the ball when it hits the bottom, spawning a new actor from the location at the bottom with the direction either by location or forward vector.

The sphere is an actor of its own, separate from the ramp which is controlled by rotating it anywhere between -60 and 60 degrees on its Z axis (left and right). The purpose of the ball’s bouncing is, without revealing too much, so it can travel down a lane and hit its targets on the other end. So I’m not sure if an animation would work because where the ball goes should depend on where the player is aiming.