Make Ball roll fully with torque

Hi, How do I make my player, a ball roll fully instead of these half rolls that reset?
Here is a video:


The ball’s rolling does not look proper. How do I fix this? I am using Simulate Physics with Torques on UE5

1 Like

How are you applying torque?

I wonder why most people wants to roll a ball with torque. Just use ADD FORCE (push it!)

here the method I use:

I don’t use Character BP…I work with a custom PAWN actor.
I apply the force to the ball static mesh component…I dont care the position or state of the pawn in the world…I work with the ball itself
I have a center ball pivot (scene component) that I update with the center of the ball all the time, so no matter the balls orientation, I always have the balls center with the world orientation in a pivot where I can attach another scene component that controls the yaw (orbit) of the camera) and also I control the pitch of the camera (up/down) in the spring component.

For the movement of the ball I just apply ADD FORCE in the direction of the facing camera for forward backwards and I use the right vector direction for the side moving.

Hope it helps

1 Like

To simulate friction, to get it spinning; lots of things impulses cannot achieve or would make it look unnatural or undesired.


To do it with torque, you could use the camera arm’s right vector. Kind of depends on how you want the direction to work, though.

I understand…but most common usage I see here is trying to control the ball and I think in the real world if you want to drive a ball you push it in the direction you want to move it. don’t apply torque. floor and air friction works anyway

It looks a bit better after doing that. It rolls more but does not do it fully.

The UE4 Rolling Ball template has it fully implemented, using torque also opens up for the use of physical materials properly, which I’m almost certain you’d need, judging by the video. Because who doesn’t want to have a ball skid on ice?!

You can just duplicate it. If you don’t have / want UE4:


If you’re going to base the movement direction on the camera, use its right vector instead. It really depends on how you want the camera to work. Here’s an example for the cam following velocity:

But you may want another solution, ofc.


Here’s a 7 year old (!) example how to use the Right Vector I mentioned above:

Good luck!

1 Like

This is neat! But I guess the method to use would depend on the desired result. You have some really tight controls there. Right tool for the right job, ofc.

I made the sphere have simulate physics instead of the Capsule Component and it works but the capsule does not move with it. I tried Set World Location on it and it had weird results. It just made the player glitchely fly through the level. So I have to fix that.

Why are you using a capsule? Have a look at the pawn setup I posted above. And replicate it. Or have a look at the template.

For something like this you probably do not even need a movement or additional collision comp. Keep it simple, at least for now.

I accidently added the Capsule thing as a first timer due to the character blueprint. So, I have to redo everything in a new BP?
Edit: I need the collision for enemies to interact.

If your player is not a bipedal humanoid with animations and all, there’s no need for the character blueprint, movement components or capsule collision. If you want a simple physically simulated ball you can posses and control - make a pawn, as in the pic above:

image

You can always add an additional sphere collision or do it the other way round: use the sphere collision to simulate and collide and the static mesh for visualisation only. Optional.

I made a pawn and the enemies don’t move and I get an error after exiting PIE:

PIE: Error: Blueprint Runtime Error: "Accessed None trying to read property CallFunc_GetPlayerCharacter_ReturnValue". Node:  SpawnActor Slapper Graph:  Throw Function:  Throw Blueprint:  Dropper

How do I fix this?

You’re trying to access a Character that you no longer have.

Get Player Pawn instead of Get Player Character.


instead of these half rolls that reset

Almost certain this was caused by the capsule being flipped. Definitely do not use a Character Blueprint for this.

But the enemies are not following the player. Here is my code for following the player:

You’re still using Get Player Character… And you do not have a Character, you have a Pawn.

I am using Get Player Pawn Edit: Accidental Reply

It is still not working.

image

Who this boy then?

We do not know how you set up your script. We’ve gone from using torque to handling AI…