How to make side scrolling character do a full turn when changing direction?
Hi all! =)
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??
(Can be either blueprints or c++)
Thanks in advance!!
asked Jun 21 '14 at 02:46 PM in Blueprint Scripting
I just created a internal vector to be only left or right, and always keep lerping rotation until forward vector aligns with that vector.
answered Oct 07 '14 at 01:44 PM
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.
i am currently facing my wish side?
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
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.
Here's the answer you're looking for:
Basically uses the "Set World Rotation" node.
When movement input is > 0, sets character facing right.
When movement input is < 0, sets character facing left
answered Jan 16 '19 at 08:42 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here