Download

Move player to cursor (first person)

Hello, so I’ve been working on a first person exploration game in Unreal for a few days now and am learning how to use blueprints. So far I’ve taken the first person shooter example, removed the gun, created a system where you can use left shift to toggle between walking and running, and hold right click to fall through the air faster.

What I would like to implement is a system where, once you’re in the air, you can left click and for a short time gravity is turned off and you are launched directly in that direction, like a homing attack from the modern Sonic games. I started by watching this video on projectile motion: https://www.youtube.com/watch?v=FvFEvxGQjug

and basically I used that to create a MouseControl controller blueprint where, when you left click it finds the vector direction of the mouse and saves it to a variable in that blueprint. Trouble is, I don’t know how to get that variable to the character blueprint through direct communication, and even with that vector I’m not sure exactly what function I could use to move the player in that direction exactly. I’m still really really new to this so please be patient with me.

Thank you for your help!

Okay, update. I used the GetPawnRotation node and the GetXVector with that to create the vector for the direction the mouse is facing within the player blueprint, so I eliminated the mouse control class. Now I just don’t know how to get the player to move forward in the direction of that vector.

Well since you want physics to no longer exist what you want to do is turn off physics for your character once you move him into the air.

Then just get the location you want to go, create a timeline, then use a lerp to move them between the current position to the new 1 and then turn on physics a little bit before they get there.