I am making game with GTA 1 and 2 like movement (link below) and I can’t invent how to script character rotation properly. I want to rotate itself left (when press A) and right (when press D). I would be really glad for any help
Hi,
it’s probably no matter if you will make it 2D or 3D, in any case you will have object “player” (like 2D mesh, or 3D actor, really no matter). From this statement you simply can add key press events in you player BP with specific keys, just right click at event graph in your BP and type “keyboard events”, you’ll find many keys, but this is simple way, more flexible set key in project settings to make later easier key changing in game setting
so after you have key events and it’s inside your character BP all you need is “AddActorLocalRotation” and you can rotate your character at pressing A and D
How to get rid of this? It can’t pass 90 degrees. When i press A it turns left and then starts to turning right.
Animation: Porn GIF by anonymous
BP: http://scr.hu/0y9c/8ej8p
Solved: I ticked “Use controller rotation Yaw” under Pawn section in Character details
Ok I solved the problem with rotation lock. Now I want to make this rotation smooth and continuous during pressing an A button. Any idea?
Solved again xD
glad to see you got needed result, don’t forget mark question as answered, so anyone else later can have same question and may find solution faster