How do I setup a Player movement and camera scheme?

So, I’m trying to make a game with a control scheme similar to that of the Spiral Knights online game. The camera would be always facing one direction, looking down at the player character from 30 degree angle (approximately). The character would move forward back left right regardless of the direction the character is facing, but rather in line with the direction the camera is facing. The character would also have its rotation facing wherever the mouse is located, ignoring any high objects the mouse is hovering over. I’m not saying I want someone to make it for me (though I wouldn’t complain if someone did), but I would really like an idea of how to do each part because everything that I am doing so far just keep resulting in stranger and stranger results, leaving me with no idea what part I am doing right, if any. Any help would be appreciated.

There have been a lot of people trying to make this.

Movement is easy. You can move the character relative to world axis independently of rotation.

Have an input axis for X movement, and another for Y movement, and then hook them up with AddMovementInput. (assuming blueprint)

What I did was in the Tick event, make a vector of the X and Y axis and normalize it before adding the input so that the player doesn’t move twice as fast if they are going diagonally.

For rotation, it’s a little bit harder but check out my answer here:

The above answer shows how to trace the mouse onto a horizontal plane (the floor). Because it only traces to the floor, the mouse goes “through” any objects getting in the way.

If your world isn’t flat, you can set the Z location of the plane to the Z of your character so that the mouse target will always be the same level as the player.

If you want to always target the floor of a non-flat world, whilst ignoring tall objects, I haven’t done anything like it, but you’ll have to have a way to tell what objects the mouse will hit (maybe a tag or something), and then trace the mouse to those objects instead of a plane.

Hope this helps, let me know if you have trouble.

Hmmm, so I made the X and Y axis an addmovementinput thingy. I get what you mean when you say you normalize it, but, just to let you know, I have very little programming experience. I only took a single low level java class, and that was years ago. I have no idea how you would normalize that, or even what you mean when you say to convert an x and y axis into a vector?

I’ve seen and tried out your rotation tutorial already, but it gives me wierd results. First, when you use things like get controlled pawn and get view target, it gives me errors that only go away if i wire them up to a get player controller. I am using a player controller for my BP. Are you using a pawn? Also, I put my camera within this blueprint, facing the box that is my current character, but when I add your BP stuff, it is no longer facing my character so I cant actually see what is going on.

Where would you put the camera? Within the character? Define its location elsewhere? I am not sure how I would define it outside of the character BP. Honestly, I’m just a lowly modeler/ok-ish texture artist and I am just trying to get the base controls for a simple game going so that I can make it look really pretty.

Sorry, the stuff about normalizing vectors was left over in my mind from using other game engines. You just need to do a Make Vector node with the X and Y axis into the respective sockets, and run that into the World Direction input of AddMovementInput. Then put whatever scale you like (for speed).

With the rotation, what errors are you getting? It generally helps to know what they are if you want to solve them :stuck_out_tongue:
I have that logic on my Controller.

I can’t really help you with the camera as my game uses an external shared camera for all the players, but it sounds like you want it to be centered on the player. You might want it to be a component of the character. Try looking at the Top Down template?

Hi Knobbynobbes,
We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.
Thank you.