Download

Movement Direction Relative to Player Rotation

Hi Guys,

I’m working on a top down game that is similar to a twin stick shooter but with an actual crosshair. The character rotates towards the Cursor while being moved with the classic W,A,S,D.

I’d like the character to move slower when going backwards, that is moving in a direction opposite to the crosshair and am unsure how to call this?

Second to that, currently with the free basic Starter Animations pack on the Marketplace the characters movement animation doesn’t relate to the direction of movement. I get that it’s because it’s not allowed to just face the direction it’s heading and stuck facing the mouse, but is this related to the blendspace or not being able to correctly call the direction/rotation?

For movement I have the standard InputAxis MoveForward to Add Movement Input, the only difference is I call the forward vector from the Camera (so if the camera is rotated, W will always move the character up the screen etc).

For the player rotation I have a SetActorRotation on tick with a Get hit Result Under Cursor by Channel and Find Look at Rotation with Get Player Pawn.

I have a Dodge mechanic that needed to know the direction of movement and so I made two Floats that get the MoveForward and MoveRight and this works well. I assume I could use these floats to figure out the current movement direction in the Blendspace, but I’m unsure how to then figure out the rotation in relation to the movement direction?

I hope that makes sense, because I’m very tired and struggling to get this across correctly.

Any help would be much appreciated. I’ve done a number of tutorials, and can make all of this from scratch. I’ve looked over the forums as well as other sources, but couldn’t find the information I was looking for.

This is my first project and I’m really enjoying it!

Cheers,