Stop pawn Character Movement (Blueprints)

Hi there everyone.

I’m making my first simple game in UE4 and I’m making a Ball roller.
The game works with moment along the camera angle using the Forward and Right Vectors, example below.

Now i want to create a stop function when the control button is pressed so i can jump from Platform to Platform and not roll off the end.

I came up with the Idea to get the current Forward Vector and - it from its self * 2 so I would get the negative value. This would then be multiplied by the moment speed and plugged into the Impulse vector input.

This is what I have so far.

Any ideas on how I could accomplish this ?

As I know, rolling template project uses AddTorque to control forward/backward movement.

Maybe it is better to start from there?

It is also possible to use rotating movement component to create rolling behavior. Did you tried it?

I’m really not sure it is a good idea to use physics forces for that. It may produce unexpected behavior.

I tried to play with physics actors and change their velocity on fly, and everything I can to advice is to use SetPhysicsLinearVelocity and SetPhysicsAngularVelocity.

Hope it helps.

You could also try getting the linear velocity of the ball via the “Get Physics Linear Velocity” node and then adding a force opposite that every tick until the ball stops moving.

Hi there, thanks for the feedback.
At first i worked with the rolling template but decided to create it from scratch so i could learn better.

I havent tried the Rotating Movement Component yet, ill look into this.
So using addForce is no good ? what would be a scenario to use it so i may understand it better ?

Hi there and thanks for the feedback.

I’m just having a quick look and one thing throwing me off is the node between “Get Physics Linear Velocity” and the Branch in front. What is the purpose of that node ?

Just reading your code backwards, if the velocity of the Sphere is == 0, 0, 0, then stop movement = false else subtract 1000 from the Current Velocity to slow down the ball, correct ?

Yea, that’s it. Otherwise it will keep getting impulses in opposite directions which will be a waste of resources. It is also needed to reset the variable that tells it to stop.

I see. I will give this a go. Thanks so much.