Reset roll/rotation

Hi guys so i want to have my ship roll back into its rest position. Levelling itself out when the axis input is not active .I have tried getting the roll value and checking if the value is above or below zero when the axis is not active but .All my efforts have proven fruitless …My bp is missing any attempt at a solution .but please take a look and advise me if you can

You can store the original rotation value as a variable on begin play. And then set it to this value, when no input is detected. Don’t know if it was what you meant?

Hi mr_starfire,

I just finished a space shooter project with similar functionality - so I can explain how I did it.

From your input axis save the Axis value to a Float (call it InputRight). Then on Tick (or timer) check to see if this variable is bigger than 1. If so, the Player is moving left or right, so you should rotate the ship accordingly (moving right means add to the Roll for example).

However, if InputRight is 0, that means the Player is not moving, so the ship should go into its “resting position” of Roll=0. For this I set the Actor Rotation, break the rotator into its 3 values and set the Roll directly. I use a FInterpTo node and I use the ship’s current Roll and the target as 0. This means that as long as you are not moving left or right, the ship’s roll is constantly interpolating to 0 (no matter the starting roll). By using this node, you can also tweak how fast the rotation happens.

If you want even more control, you can use Timelines and play with the curve the get the exact timing to your liking :slight_smile:

Hope this helps!

Hey thanks guys .I will implement this asap i am trying to figure out the best way of laying down track and obstacles at the moment

Hi so i am not the sharpest knife in the drawer and i am confused as to what i should be doing exactly …Does your solution require a complete rewire of what i have. … I have mad a float variable called (inputright) and that is set before any roll is implemented i.e it gets the initial roll which i assume is zero… … Could you very kindly if you have the time just throw together a quick picture of what my new bp should look like .I very rarely ask for extra help even though i am slow to learn i dont like asking . But in this case i cant even explain the problem i am having

Hey mr_starfire,

I never got a notification from the forums (sigh) and just saw your reply today - here is a screenshot of my setup:


I am checking this on a timer / tick. MoveUp and MoveRight are variables that are set by the Input Axis (up / right), so they are between -1 to 1.

Hope this helps!

Why don’t you just use the ship’s relative rotation? You can simply reset your roll to 0 using a rinterp node.

Just to let you guys know this appears to be <solved / closed>… The OP double posted here