How to make an object roll when controlled as a third person character?

Hi! I am pretty much a complete beginner to UE and would need a little help with figuring out how to make a static object roll/animate in a particular way when controlled as a character.

I basically would like to replace the model of the mannequin used for the ThirdPersonTemplate with an inanimate object (cylinder, barrel, vegetable, wheel etc.) so I can keep the controls and movement, but would like for the object to roll/animate in a way that I have tried to illustrate in the attached image. I guess that would mean it rotates and moves at the Z and Y axis, but not the X?

Is this something that can be done using blueprints? If so could anyone offer some pointers or tell me how to accomplish this? I am using Unreal Engine 4.27.2

Any help is appreciated!

I think you can basically replace the current movement code with a few ā€˜add local rotationā€™ nodes.

Having said that, probably the easiest approach, is to use the rolling ball project template and replace the ball with your vegetable :slight_smile:

Thank you for your response!

Although the problem there is that by using the rolling template, the object would rotate in a way I donā€™t want it to as well as not having as controlled movement as a third person character would, with the ball/object picking up speed and keeping the momentum going in a way that I am not looking for.
I suppose that is something that could be changed, but as I said, I am still pretty unfamiliar with coding and working in UE.

But your suggestion is very much appreciated! I will keep trying to wrap my head around all this and see if I can figure things out.

Can you describe the look and feel a bit more? Itā€™s not like a rolling ball, but itā€™s more likeā€¦ ( your answer here )

This is basically what I would want. Imagine a barrel rolling on its side. I donā€™t want the barrel to ā€œstand upā€ when going to a side, but simply roll on its side. I also donā€™t necessarily want it to build momentum to how it does in the rolling template, but have more tighter controls similar to those in the Third Person Template.
As for turning then it wouldnā€™t have to turn in a bit of an arch to how I described it in the image, but could simply do a 90 degrees turn on the spot if that is easier.

Does that make sense?

1 Like

Copy the third person character. Set the skeletal mesh to nothing, and put a cylinder in like this

Then all you need is this code

barrel

That is exactly what Iā€™d like to accomplish!

However, Iā€™m afraid that Iā€™m not exactly sure how to do what you ask by setting the mesh to ā€œnothingā€. Since it is an inherited mesh, does that mean I need to do something before it can be changed? Since it doesnā€™t seem like I can even delete or reorder the mesh in the components window. Would I have to change something using C++?

As for the blueprint, I guess I canā€™t do what you did since I need to do those changes to the mesh first? This is the closest I could get to what you did, unless Iā€™m missing something since it doesnā€™t seem like the ā€œAdd LocalRotationā€ node has a way to connect a Float component which seems to be the case with your blueprint?

I do apologise if Iā€™m missing something rather rudimentary here, but the help I have received so far has at least given me an idea on what to do.

right click on the node

You my friend deserve all the praise. That fixed it!
Thank you so much for your help! :smiley:

1 Like

How am I supposed to know what some of that code is? Could you possibly share the C++? or am I just being stupid? Iā€™m very new to this blueprints stuff and have no clue what that Target Velocity node is or the one that says Add pin

There is no C++, thatā€™s the point of doing in blueprint.

The variable of concern there is, the velocity from the character movement component.

Itā€™s just multiplied by a constant, donā€™t worry about the add pin thing.