In the project I am working on, I am trying to allow the player mesh to move forwards and backwards while having left and right input rotate the player around a central point. As of right now, my setup is as follows:
Root → Spring Arm → Static Mesh ->Box collision ->Spring arm / Camera
The root is a sphere that I am using to cause the rotation I want. That portion is working as intended. However, when it comes to movement it falls apart. I used the following BP and it caused the whole system to move forward, which throws off the “pivot point” I am trying to circle around.
As a result, I attempted to instead use a spring arm and adjust the target arm length to offset the player from the center by using this BP setup:
It wasn’t yielding any results, other than making my player get locked to 0. (It’s why I put a print on it, I thought it was moving it into the distance somewhere, but instead it was throwing the actor inside the root and keeping it pinned there.) I turned off collision for the root just to see if the movement would work on the player mesh. It didn’t.
Long story short, I would like to know if there’s a way to move a child actor independently from the root, as I seem to be getting nowhere with spring arms. I will alternatively take a fix on the spring arm end if there is one.
I believe simple movement input would always move the entire character with the root inclusively.
Trying to change the mesh’s location relatively to the root might work.
I tried to recreate your logic, but I used a simple Float variable instead of Arm Length. The problem is this: when you launch the game, your axis input is 0. Your arm length becomes 0 right away, And then you multiply your input by 0 every time. Of course it will always be 0.
You shouldn’t multiply it by your Amr Length. Try putting there some other value.
Oops. I accidentally selected “private” instead of “unlisted”. It should be visible now.
Anyways, I tried changing it to an addition and it still snaps, albeit a smaller distance than before. To further make sure I also removed the first multiply node and went directly from the move-forward. I then replaced the multiply node with an addition node of the same value as the initial multiply node. Both of these alterations also varied the distance of the snap, but snapped non-the-less.
Essentially, I needed to re-add the target arm length at the start of it, but get rid of the multiplication nodes and replace it with a single addition node.
One minor complaint is I had to crank up the scale of the inputaxis to 5 due to how slow my pawn was moving forwards and backwards. I couldn’t place any nodes between the float add and set due to Unreal automatically multiplying or adding the number until it reached infinity once I hit play. I’m sure there may be another fix, but this works, and I will probably be able to blueprint edit the value anyways if I ever need to speed it up or slow it down in game.
Thanks for the help. I wouldn’t have thought of the float add node anytime soon. I was under the impression it would take the value I had initially set on the target arm length (380) and use that as the starting point to multiply from. Oddly enough, when using the add, the game automatically offsets it to 380. Perhaps it’s a bug.
I posted a more in depth solution below if anyone is having a similar problem.
I initially asked this question a couple months ago on StackOverflow before I had even worked out the rotational component of what I wanted. I’ll post a link to the solution there, as it goes in depth on the whole setup, to include the aforementioned rotation.