I’ve started with the Side Scrolling Template. It do almost fine, but there is one problem.
When I’m moving right, then I press the left button, the character starts to turn. If I release the left button while turning the character stops imediately, facing towards the camera. I need the caracter to do a full 180 degree turn even if I just tap the left button, always facing sideways.
Messing aroung I found a RotationRate, that makes it turns faster, but the problem still occurs.
How can I achieve that??
Hi man ,
if you want that the char once started the rotation dont stop
if you unpress the key, you have to put this actions elsewhere.
you want start the flipping with Left or Right, so in the event Key , set a WishSide to 0, or 1.
and then in the tick event , check all and rotate your char.
something like:
i am currently facing my wish side?
so i put turning to 1 and slowly turn my rotation, tick by tick, toward my wish side.
when i get the rotation , i set my currentside, and turning to 0
while the turning is active i still can choose another direction ,
i will ignore that my wish side and my current side match, because i still turning(1) , and probably i am half turned.
Booleans
WishSide = this is the boolean you change with the InputKeys
CurrentSide = this one keep your status, if you are currently watching Left 1 or Right 0
Turning == if this you are currently turning
thats a little messy , but the meaning part, its’ you want execute the event rotation , freely from the button.
so you have to call the rotation from another place. Example:the Tick event
Thanks to Est_engine’s comments, I’ve found a solution to do a full 180 turn (and keep the character facing the camera when turning) which I’ve posted here. Thanks for your great input, Est_engine!
In Class defaults just find bool variable with name Use controller Rotation yaw. While is true then is Rotation of Character mesh reset to default value (e.g. -90), but when is false then rotation after input is stopped in position of current state and it doesnt reset it.