Topdown Camera Movement

I’m starting to slowly get used to blueprints (except variables sharing) and I’ve created a top_down camera which I can move when I move the mouse with the right mouse button held down. However I’ve solved why its not moving the pawn correctly (I need the cursor location to provide the value to move the pawn by).

16593-possess+camera.png

This possess the Camera Pawn I’ve created at begin play. I’m using a pawn because I’m trying not to rely on the character everytime I want to create something.

This is want I came up with to move the pawn (which has the camera), it may be wrong or long winded but I actually worked it out without canabilising any tutorials or examples. Its in the camera pawn blueprint by the way.

My question is how do I get the cursors location on the screen and the size of the screen (to get the center value) to then create a value to feed into the vector. I have a feeling I can’t get the screen information inside a pawn blueprint.

Hi Zedrophobe,

You want to use the “Convert Mouse Position to Local World Space” node to get the mouse position relative to world space, or if you simply want the X,Y of the mouse you can use the “Get Mouse Position” node for the mouse position. Can you be more specific about the screen size? Are you talking specifically about the hardware the user will be on or the relative screen in editor.

Hi sorry reply has been so long (work), I’ve tried the Convert Mouse Position to Local World Space and it returns 0 or wouldn’t compile. Get mouse positon also returned no information, just 0,0 or no debug data.

I’ve since installed Rama’s plugins which allows me to get the screen size and mouse location in my pawn. Not ideal solution for me because I’d like to learn how to do it without 3rd party functions but if thats my only options I’ll will settle for that.

In spite of that, how would you get the screen X, Y size information and mouse position. Or could you provide me with why get mouse position isn’t working in my pawn blueprint. Or do I have to send that information from the HUD blueprint.

It may be worthwhile to try and get the mouse position via the player controller instead of the player pawn. Try a simple print string for the mouse position in your player controller and see if it gets a response.