Blueprint Scripting simple vector movement
Hi, I'm trying to make a simple pawn with inputs to move along the Z and Y axis. Currently I have a pawn without scripting, Auto possess enabled and Player 0 set for taking input. The playercontroller has the input commands and has flows to SetActorLocation with a node connecting to its new location as follows ( GetActorLocation > (vector + vector) Z +100 > SetActorLocation) The action for the input fires, but nothing happens. I've tried other suggestions involving Axis movement and blueprinting in the pawn. However the results are random as sometimes it will work when reworking from scratch again and other times it will simply not fire at all.
asked Feb 26 '19 at 05:52 PM in Blueprint Scripting
I just reproduced this setup and it works fine. Here is what you need to do.
In the pawn BP, select "Your_Pawn_Name(Self)" from the components tab in the viewport. On the right hand side, look for the sub category tab "Pawn". In this category you should see, "Auto Possess Player". Spare yourself the trouble of assigning a controller and select "Player 0". Open up your game mode. Look at the top panel and find "Class Defaults". Select this tab. On the right hand side you should see a list of options with drop down menus. Find "Player Controller Class" select the player controller BP you created. Find "Default Pawn Class", select the pawn you created. In your controller place the following script....
Finally, open up your level. On the right hand side you should see a tab that says "World Settings". Click this. The second category is "Game Mode Override", select your game mode from the drop down menu. You should see if you expand the "Selected Game Mode" arrow below it your default settings you set up with your player controller and pawn. And last but not least, open up your level BP and place this script in there.
Now when you hit play and press the "T" key or whatever key you want it to be, your pawn will move up 100 units on the Z axis.
Follow this question
Once you sign in you will be able to subscribe for any updates here