How would I increase a value in relative to the rotation?

I’m just wondering how I would have say a float variable: currentRotation = 0 and increase it by 1 for every degree my character rotates to the right (in first person) and decrease it by 1 for every degree to the left? I done this in Gamemaker before to align the movement with the sprite but I can’t figure it out in UE4. It’s simple but I don’t know if it can be done through blueprints.

I tried using the mouse axis that I added in the settings but that always gives weird values (ex: sometimes +1, other times +5, etc). Sadly I don’t have any blueprints to show because I was just messing around with UE4.

Thank you.

Hi man ,
i know unreal is not the most easy software on earth. some easy thing came out really complex sometime.
I dont catch why you want to to this and how you want to procede once you char go 180° or make a full turn on the right.
You can easily track the amount passed out from the mouseX, Y if you use them for the rotation of the char.
Just make a variable and add the amount passed by those events (mouseXY).
They work so , for every tick , the pass you the amount of movement of the mouse.
If you dont move they pass you 0, you move slow, they pass you 0.2 , if you roll away the mouse 4 5.
When you read the value you can have any number.

If is <0, you turned left. , if is < -180 you made at least 1 full turn on the left.

If is >0 you turned right, if is >+160 you made at least a full turn on right.

Its a bit Tricky…

Lets say that you can break the rotation of your actor anytime, and get a value from Z that go from -179 to 0 to +179.
You cant count the full turn , but its usefull.

I often have to change back my project because i found that flipping all the problem upside down its more easy than solve some logic-problem. So dont be too obstinate , try also to avoid the walls on the way.

I have tried passing the mouseX and I can do a full 180 but it passes ~90. What im trying now is multiplying mouseX values by 2.

What game play behavior are you trying to achieve? The answer to your question is use Get Relative Rotation and increment based on the value. But I suspect your real question is something else. Without knowing what game play behavior you’re trying to achieve its hard to give you a better answer.

I decided on making a bunnyhop game like in counter strike and so far everything works I just want to lose speed if I turn too much while in the air.

I would probably not bother with that mechanic unless your jumps are exaggerated (zero gravity for example). Too much work for very little gain, you’ll be hard pressed to notice a difference. If you are hellbent on pursuing that however, look at the CharacterMovement component on your characters.

There are two settings there: Air Control and Falling Lateral Friction. Take a snapshot of GetActorRotation on Jump event. Then on tick write code to compare that snapshot with actor’s current rotation. If it differs more than by 10-20 degrees, you can lower progressively lower Air Control to 0 and increase Falling Lateral Friction upwards.

This would work in zero-gravity type simulations but I wouldn’t try it in a normal game. When I played around with it - it just feels wrong.

Hi man , here an example. as you can see i can say how much rotation was given to the actor reading the VAR_R.
lets say a crazy thing, i have rotated a lot the actor and the value show 3333.
I can divide the 333/360 and get 9.2… i have done 9 full turn on the right and 2/10 of another turn.

By the way reading for what you want to do .
You can surely take a look at Nick Jackson post.
I think you can also do this.
Once you jump, save your vector in a variable (Start_Jump_vector). Now from there on, during the jump.
Get the starting_Jump_vector and sutract it to your current vector. Then use the Lenght vector node , to the output.
This will give you a float. that will be Greater as you turn away from the starting vector.
Just use that to decrese what you want, and be sure to set every time the start jumping vector, to the current.
You are Always working costantly . (tick_event)