# Moving an object by pointing another object at it

**URL:** <https://forums.unrealengine.com/t/moving-an-object-by-pointing-another-object-at-it/1657869>\
**Category:** Blueprint\
**Tags:** unreal-engine, question, Blueprint\
**Created:** [February 1, 2024, 10:00am UTC](https://forums.unrealengine.com/t/moving-an-object-by-pointing-another-object-at-it/1657869 "2024-02-01T10:00:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wolfear87](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@wolfear87](https://forums.unrealengine.com/u/wolfear87)\
**Post date:** [February 1, 2024, 10:00am UTC](https://forums.unrealengine.com/t/moving-an-object-by-pointing-another-object-at-it/1657869/1 "2024-02-01T10:00:36Z")

</div>

Hoping someone could help me with a hypothetical, or point me in the right direction. Let’s say I have a first person character, a cube and a sphere. I want the character to be able to pick up the cube and point it at the sphere, which causes it to move vertically from point A to point B. Then, when the cube is no longer pointing at it, the sphere floats back down to point A. And it’s triggered regardless of where the sphere is, for instance, if I point the cube at the sphere and it moves to point B, then I stop pointing and it starts to go back to A ( only halfway to it), then I point at it again and it starts going to point B again. I was thinking of a line trace from the cube to the sphere, as I know how to make an object do something through the line trace and can set it to trigger when the object is picked up, but I don’t understand how it would go back to its original position when not casting the trace.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 1, 2024, 10:38am UTC](https://forums.unrealengine.com/t/moving-an-object-by-pointing-another-object-at-it/1657869/2 "2024-02-01T10:38:55Z")

</div>

> [@wolfear87](#):
>
> how it would go back to its original position when not casting the trace

See if this 👇 helps with this 👆 particular bit.

- a standard forward camera trace:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/a/0/ba00818f8b8ce1a7b174c4df49b82a12d902e242.png)

You’d use an interface or inheritance if there are more types to handle, ofc.

- not sure how you want stuff to move, here it’s via a timeline:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/3/a/23ae2a94536e186793336e31f4ba8b19d9695695.png)

- which results in:

- the branches in the script prevent it from spamming since we’re tracing on Tick:

Hopefully you can adapt it to your needs.

* * *

It’s a setup similar to this one:

> [@Third person crosshair object highlight troubles](https://forums.unrealengine.com/t/third-person-crosshair-object-highlight-troubles/252041/13):
>
> The communication in the example revolves around Inheritance + Interface - a potent combo, imho. the base class implements the interface (which children inherit) the widget uses the same interface - calls children receive can be propagated: Actor → Widget Component → Widget without casting or finding user widgets (this can be done in many ways, though) the player has a collision sphere and sends an interface call to overlapped actors as we approach: [image] [image] Above, handl…

---

<div class="post-metadata">

**Author:** ![wolfear87](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@wolfear87](https://forums.unrealengine.com/u/wolfear87)\
**Post date:** [February 1, 2024, 10:52am UTC](https://forums.unrealengine.com/t/moving-an-object-by-pointing-another-object-at-it/1657869/3 "2024-02-01T10:52:32Z")

</div>

This is perfect thank you! I think I tried the branch out of the return node from the trace which is where I went wrong with it- and didn’t realise that there was a “blocking hit” node. total noob.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [March 2, 2024, 10:52am UTC](https://forums.unrealengine.com/t/moving-an-object-by-pointing-another-object-at-it/1657869/4 "2024-03-02T10:52:42Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
