Move Actor along X-Axis

Hello,
I’ve been stuck on this simple problem for 2 hours now… How do I get an actor to move along the X-axis only? I’m trying to get my object to move along that axis, but nothing is working. Any help would be much appreciated! I’ve googled everything I could and still got nothing.

Thanks,

I am also a newbie. All I can say first you have to set input in project settings. Axis input and two button with 1 and -1 scale. Then in character blueprint, you have to add that inputaxis connected with “add movement input” and set the world direction in that. You have to tweak the world direction to get the movement along your desired axis. Hope it can help.

In project settings, Look under “Engine” → “Input” → “Bindings” → “Axis Mappings” → And then remove the one you don’t want. MoveRight both account for right/left, and forward is forward/backward.

Hope it helps :slight_smile:

I’m working with a ball and I want that ball to constantly roll a long the x axis. I’ve tried making the ball an actor and pawn and still can’t get it to move. I tried making it like a player but still couldn’t get it to move. So far, I can only get it to rotate

815a44cb0409a99b64fb0d9a7776b517b4e3b70b.jpeg

One of these setups might work depending on what you need.

All targets should of course be your actor.

The first one is simplest to do. Since it just moves the actor. However since it just places it, you need to set the delay timer low to make it seem smooth. Or else it will move “laggy”
The second one is to make the ball a pawn, and assigning ai to it, and then get it to move. Here the refresh just need to happen before it reaches the destination. You need to setup movement for the ball though.
The third setup involves a timeline, wherein you make a vector line. Leave y and constant, and set x to be the same value (not zero) all the way over. If you vary it, the ball will roll faster/slower depending on the slope on the curve. :slight_smile:

I didn’t get any of these to work :frowning: The ball just sits in one position. I want the ball to constantly move along the x axis with no input. Right when the game starts, the ball starts rolling. Just like the endless runner tutorials from unreal engine, they made the player constantly run forward without pressing any buttons. I want my ball to do something like that.

MoveSpeed is a variable you could create. Though you don’t need it, you could directly enter the X value into the + node.
It is a “Vector + Vector” node. Rightclick one of the pins and click “Split Struct Pin” to get the 3 X,Y and Z floats like i have in the screen.

That worked! Thank you so much! For what ever reason, it wouldn’t work for me the first time! Thank you!:smiley: few

No problem. Just one additional note: If you hit “Sweep” at the SetActorLocation node, the pawn will be moved to that location like you were pushing it.
So HitCollision etc will be called. If it is not ticked, the Actor will teleport to the new position. Maybe this will be important for you in some way.

A slight nitpick but one that makes it functional vs non-functional - at least from what I have experienced in 4.19… eXi’s use of floats doing the vector arithmetic doesn’t work for setting an actor’s location except in the circumstance of the Event Tick. Vector + vector does.as posited by Fjordhoj, Though eXi’s code does work for a constant moving by Event Tick which he presented above — which is odd, but something that I’ve observed.vectoraddsetloc.JPG

Thank you. I used Event Tick instead of delay timer