I’m creating a game where players do not move their characters directly but instead move using chat commands. I created the HUD that has the command line and a send button and successfully sent the two variables I want to the Player Controller. One is a string called “Command” and the other is “Movement”.
I started with the simplest command first, which is Forward, when the player types Forward + Number and then presses the Send button I want his character to actually move forward the given distance.
I created a nav mesh around my map and then used Simple Move to Location to move the character around. My problem is that Simple Move to Location requires a Vector as input (the coordinates to move to) but I have only distance as my variable.
This following blueprint works as long as the character is looking Forward:
But of course if I turn the character around it fails because my Goal vector doesn’t take into account where my character is looking at.
I tried using Move Forward like this:
But I have a character, not a pawn and the casting always fails. Using “Get Player Character” and casting into Default Pawn also fails.
So I have two questions:
a) Can I make a “proper” Goal vector that takes direction into account?
b) Is there a simpler way of doing this?
EDIT:
A follow-up to my question. I managed to make the character move to the proper destination, and in the process I recalled trigonometry.
So this answers my question a) making a proper vector, but not b) if there is a simpler way of doing this without messing with trigonometry.
And besides I noticed in a map that has some actual objects around, like cubes and stairs, Simple Move To Location tries to find an optimal way around them while I don’t want any kind of AI to be used here.