# Pushing an object to the x or y axis using a key

**URL:** <https://forums.unrealengine.com/t/pushing-an-object-to-the-x-or-y-axis-using-a-key/2654916>\
**Category:** Blueprint\
**Tags:** unreal-engine, question\
**Created:** [September 8, 2025, 10:26pm UTC](https://forums.unrealengine.com/t/pushing-an-object-to-the-x-or-y-axis-using-a-key/2654916 "2025-09-08T22:26:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ddave104](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ddave104/32/1000318_2.png) [@ddave104](https://forums.unrealengine.com/u/ddave104)\
**Post date:** [September 8, 2025, 10:26pm UTC](https://forums.unrealengine.com/t/pushing-an-object-to-the-x-or-y-axis-using-a-key/2654916/1 "2025-09-08T22:26:15Z")

</div>

I’m trying to push a box in the direction my player is facing (x or y ) for a certain distance everytime the player click a key. How would I be able to do this? Any help is appreciated thanks

---

<div class="post-metadata">

**Author:** ![doctorpepperdan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@doctorpepperdan](https://forums.unrealengine.com/u/doctorpepperdan)\
**Post date:** [September 9, 2025, 2:41am UTC](https://forums.unrealengine.com/t/pushing-an-object-to-the-x-or-y-axis-using-a-key/2654916/2 "2025-09-09T02:41:26Z")

</div>

There are a few ways, we’d have to know few things first, is it just x or y? Like on a grid type movement? Or at an angle/diagonal as well? Are you wanting a precise amount of movement? Or just to be pushed in that direction a few feet or so?

---

<div class="post-metadata">

**Author:** ![dZh0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dZh0](https://forums.unrealengine.com/u/dZh0)\
**Post date:** [September 9, 2025, 6:47am UTC](https://forums.unrealengine.com/t/pushing-an-object-to-the-x-or-y-axis-using-a-key/2654916/4 "2025-09-09T06:47:53Z")

</div>

Cheers!

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/0/a/30a7a79ad0d36428b44d7e7df8df05b2908f31d5.jpeg)

P.S. Don’t forget to set `Auto Receive Input = Player 0` in the Class Defaults or the InputAction won’t fire.

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [September 10, 2025, 7:37pm UTC](https://forums.unrealengine.com/t/pushing-an-object-to-the-x-or-y-axis-using-a-key/2654916/6 "2025-09-10T19:37:58Z")

</div>

What is the purpose - is this a character with animation pushing a box, or is it just a programmatic need?

Then - does the box need to react to physics or is it just being pushed across space (and time tardis style, if so is it bigger on the inside) ?

What you need vastly dictates how you handle it.

A character with an animation for pushing can be made with a root motion animation so that the amount you push is directly controlled by the animation itself. This makes you able to break off from the push to a “pointless push" animatiom when you disable moment somehow (probably based on collision detection).

Moving anything via code on an axis is pretty trivial on the other hand. Just get the forward vector, add to it over a timeline component that drives how long and how far you want it to be pushed. You do still need to detect and disable this if you intend to react to collisions, so build with that in mind…
