How do I get the directional vector from left thumb stick?

In my third person character blueprint I’m spawning an actor at it’s feet that I then want to move around the screen with the left thumbstick. The plan is to use this as a targeting system that when I release the input it explodes or creates some other object at that location.

I can’t seem to figure out how to get the thumbstick input as a directional vector and move the actor based on it. I first tried possessing the actor but that breaks other things like my camera setup. I’d like to keep the third person character facing where I’m aiming with the thumbstick which also breaks if I use possess.

I also tried get left stick X/Y axis but that seems to return the magnitude of the stick input 1 through -1 but I’m not sure how to turn that into a vector.

If anyone has examples of how to do this I’d appreciate it.

Thanks.

sound like you want to use the ‘get right vector’ node

Hmm, I’m messing around with “get right vector” now but I’m not sure how to apply it. How would you use it in the setup from the image?

I can, but I could use some clarification on how you want the movement to work.
Is this a sidescroller game?
Is the actor being spawned a character that needs to walk on the ground or a projectile that flies through the air?
Do you want to be able to control both the actor being spawned and the original third person character at the same time or are you switching between them?
how do you want the camera to behave, do you want the camera to follow the new actor?

Maybe there’s a game with a similar mechanic you can just link a video to?

I made this game in another engine and this is what I’m reproducing in Unreal:

Local coop. When the player holds a face button down it creates a spell targeting icon. The mage stands there playing a casting animation loop as you drive the icon around. On input release enables the collision volume for on actor over lap or uses that location to then spawn the spell… Sheep, aoe explode or whatever.

Most of that is easy but I’m having a hard time with getting the actor to move around relative to the camera. Or just move around at all.

This is what I have so far in Unreal for a bit more context:

I put an example together you can look at over here.

This is awesome. Thanks for putting that video together.

I ran into two problems:

How to get the position of the projected decal so I know where to spawn the spell object?

and

My camera is contained in a separate actor BP so I can track both characters. I’ve been trying to figure out how to get the scene component on the camera boom in the character BP to hook up to “Get Forward Vector” and Get Right Vector"

What I’ve tried so far on both of those hasn’t been working.

when you fire the spell run a spheretrace from the decal’s world location. add or subtract a bit from the z value for the start and end locations.

if you have bridges that enemies could hide under you may need to do a multi spheretrace and look for enemy actors in the array it returns.

is the camera supposed to be at the average position between the two characters?
I’m not sure that you would need the camera to be a part of the character. the spring arm could be part of the camera bp, and then you could have a function in the camera to move to the average position which is called whenever you move the characters. are you having trouble getting a reference to the camera in your character bp or vice versa?

If it’s a single player game the camera could be the pawn you possess, and control the characters through it by calling functions or sending interface messages. you’d have the camera spawn the characters so you get a reference to them. you could have the decal in the camera if you wanted to.

edit: nevermind the last bit noticed you said local coop earlier

Getting variable information from BPs that are not character BPs has been an issue for me from the start. Haven’t figured out what to put in the object wildcard when I do “Cast To Weapon” or “Cast To Camera” etc.

I think that’s my issue here. I need some way to get the Scene_Camera_Facing from my camera bp into my player character BP so I can get it’s forward vector. I tried making it a global object variable and setting it on begin play. But when I tried to pull it up in my character BP it wasn’t working.

This is the camera BP setup I’m using to track between the two local coop players and the setup you showed me in your video applied to my player:

Thanks for the help.

there are a few ways your characters could get a reference to the camera.

  1. on the begin play of the character you could run ‘get all actors of class’ since there’s only one camera the first element of the array would be the camera. to get the first element of an array you use the ‘get’ node. Then you save that to a variable.

  2. you could make a variable in the game mode of type bp_camera. on the begin play of your camera you can cast to the game mode and set the camera variable to itself. Then you players can reference the camera through casting to the game mode when they spawn in.

to cast to a gamemode you add a ‘get gamemode’ node and then use that as the reference when you cast to the specific gamemode.

I haven’t tested it yet but I was thinking there’s a node called “project vector on to plane” which might work instead of having the scene_camera_facing. Should do the same thing but feel less hacky.
there’s an example setup over here.

Ah, nice. I wasn’t sure how much I should use “get all actors of class” but I suppose if I just run it one time at the start it can’t be that bad. This has opened a bunch of stuff up. I tried the first option and it seems to be working. I’ll give the others a shot too.

Thanks!

How do you get the decals world location? Wouldn’t that return the decal components location? If you move it up a slope or down a slope the decal material is projected onto what it hits… and that’s the position I’d need to get but I haven’t figured out how.

In my previous projects I think I made a raycast rig and I was able to store the point locations of what it was hitting.