I have a few questions about the movement of the player character .
I am creating a runner and I need to realize a few things.
I need a character to himself ran forward , but stayed at certain events . For example hit the area , stopped for 2 seconds, and then ran on. Constant running I realized using Event tick, but now I can not stop
2 . If you hold down the right \ left , the character shifted sideways by 2 meters , when the key is released , he comes back.
The question is how to move it 2 meters.
3 . How best to implement a smooth change of speed of the character ? For example at the beginning of the level of the maximum speed of 2000, and then every second it falls .
Iâm going to do my best to answer what I think youâre asking.
First off, one way of pausing the movement of the playerâs pawn for two seconds would be to create a matinee sequence for whatever happens there if itâs supposed to be cinematic. If not, you can create a level blueprint that does that using a number of different combinations(That is a more complex question in itself, so if that is your question ask if on itâs own in blueprints).
Second, i think youâre talking about the camera actor and how it tracks the pawn, and that is built in with the sidescroller template. If you select the blueprint template and browse through all the class blueprints, youâll have a better understanding of how itâs set up. Then you can tweak the camera, pawn, and other actors.
Third, Once again blueprints. Iâve been trying to figure our how to decay something over time myself, Iâm not sure if i can answer that one as i lack the knowledge. but i thought Iâd help you with your other two!
how did you get it so the character runs forward by itself?
Iâm trying to get a camera (or invisible sphere with the cam attached to it or something) to move forward by itself using blueprint, but iâm fairly new to this and i cant figure it out.
Hey Guys, so specifically this is the default Character Blueprint in UE4.
In the blue box is what makes the player move forward, the inputaxis âmove forwardâ is what makes the character move directly forward and back, In the red box, the Input axis âMove rightâ is what allows the player to move left and right. Iâm not sure as to make the player âReturnâ to a single point, but you can create movement input to move left and right the way you want it to via the red box.
And MGtmaggot, go ahead and create a character blueprint for your sphere, and hook up exactly what you see in this image in itâs eventgraph, then go set the default pawn as that blueprint. Also you can add a camera there and set up what the player sees.
I guess this is not really what i want to happen, i hooked up the event graph you provided to my âsphere camera thingâ and i can move forward but itâs not moving forward by itself, i still need to press âwâ to move forward and âsâ to move back, is there any way to just have it to move forward by itself?
Simply add movement input with fixed value per tick, or use variable if you want to change speed. To stop character from moving you have to use book variable like CanRun and check it before adding movement.
To answer topic starter, you probably would want to use animations with rootmotion for strafe movement. You can also lerp between current location & current location + 2 meters to the left/right, but I assume you want some cool animations
Updated blueprint that iâve uploaded below to fit your needs. Strafes back to the side when key is released and speed is decreasing every second. Youâd like to create a function for strafing, either blueprint is messy a bit.
This character blueprint constantly moves character forward if CanRun is true, if player presses Space it toggles CanRun(false to true, true to false). MovementValue should be between 0 and 1.
Movement to the left/right still depends on MaxWalkSpeed value of character movement component. To quickly move character to the right/left either play animation with root motion as i said in answer, or manually lerp position.
sorry to ask this, i feel really stupid now but, I can figure this out, so thank you very much but thereâs one (well, actually two) thing that i canât figure out and that is:
the âCanRunâ node, i canât figure out what kind of node that is (i know itâs not in there by default soâŚ)
And the same aplies to the âMovementValueâ node.
if youâd like to explain those two nodes and what those are Iâd be very, very happy. (i know the âCanRunâ is a boolean and the âMovementValueâ is a well, value node, but thatâs basically it)
well yeah i know, but the thing is, i donât know how to add them
iâm nowhere near a programmer, iâm a visuals guy and i thought that blueprints was a lot easier (well it is) than to code it, but now I have my doubts.
I can follow along with the whole blueprint image, you provided (and i will credit you once iâm finished with my little prototype) but itâs just those two little variables, i cant figure those out.
well actually i did, i created the âlight switchâ and the âsliding doorâ. But as I said, iâm a visuals guy, i just canât remember code and variables and so on.
Check latest blueprint, character moves to right/left and remains at that line as long as player has button pressed, character moves back to the middle line as soon as player releases the button.