# How to click drag/move an actor during runtime play?

**URL:** <https://forums.unrealengine.com/t/how-to-click-drag-move-an-actor-during-runtime-play/471417>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [September 16, 2020, 5:59am UTC](https://forums.unrealengine.com/t/how-to-click-drag-move-an-actor-during-runtime-play/471417 "2020-09-16T05:59:14Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pheonix00](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pheonix00](https://forums.unrealengine.com/u/Pheonix00)\
**Post date:** [September 16, 2020, 5:59am UTC](https://forums.unrealengine.com/t/how-to-click-drag-move-an-actor-during-runtime-play/471417/1 "2020-09-16T05:59:14Z")

</div>

I’m trying to left click drag/move an actor around on just the XY plane. Kind of like the move axis mode in editor, but for runtime instead?

---

<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:** [September 16, 2020, 8:18am UTC](https://forums.unrealengine.com/t/how-to-click-drag-move-an-actor-during-runtime-play/471417/2 "2020-09-16T08:18:55Z")

</div>

Many ways, depending on what it’s supposed to be used for (as in the end goal since there’s probably more to it than just shifting boxes about); here’s yet another one:

 ![313779-screenshot-2020-09-16-091723.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/c/8/8c85e13164c0047efae99341ff77447ef50a0060.jpeg)

[![Image from Gyazo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/2/b/92b8fc2844b9a592753d9a53314e6b3180f68f52.gif)](https://gyazo.com/d04f80f126a18ec992afde6d41ab765f)

---

<div class="post-metadata">

**Author:** ![Pheonix00](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pheonix00](https://forums.unrealengine.com/u/Pheonix00)\
**Post date:** [September 16, 2020, 10:09am UTC](https://forums.unrealengine.com/t/how-to-click-drag-move-an-actor-during-runtime-play/471417/3 "2020-09-16T10:09:52Z")

</div>

Well that definitely worked as advertised. It did the moving part for sure, but caused some other unwanted buggy effects in my system (understandably). The item I’m moving around is a waypoint cylinder blueprint, part of an array in a RTS style waypoint system made with a spline. With the spline points being the waypoint actor and the connection lines in between them being splinemeshs. Your approach definitely moves waypoint actor around, but erases any other waypoints on the map thus breaking the waypoint system. Also, the splinemesh making up the connection line doesn’t update with the waypoint actor movement.

 ![313792-basicwaypointui.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/e/c/5ec6685277dad67221e70088c4a2146a921ce714.jpeg)

thats my original

---

<div class="post-metadata">

**Author:** ![Pheonix00](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pheonix00](https://forums.unrealengine.com/u/Pheonix00)\
**Post date:** [September 16, 2020, 10:18am UTC](https://forums.unrealengine.com/t/how-to-click-drag-move-an-actor-during-runtime-play/471417/4 "2020-09-16T10:18:22Z")

</div>

![313784-4f5av4.gif](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/6/4/864d4a243f8b38b7fb5ae7a04b25060865e59c4d.gif)

With your approach…

would greatly appreciate solving both problems if possible: (1) the multiple waypoints moving around (2) splinemesh updating dynamically

---

<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:** [September 16, 2020, 10:27am UTC](https://forums.unrealengine.com/t/how-to-click-drag-move-an-actor-during-runtime-play/471417/5 "2020-09-16T10:27:14Z")

</div>

> erases any other waypoints on the map  
> thus breaking the waypoint system.

You’d need to show your implementation of this. My example does not have splines. But it should work fine. I have a similar system in place actually:

[![Image from Gyazo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/b/e/8bebb0b8327da6e36e28cf1e8ab9a4eb95612ad5.gif)](https://gyazo.com/0ba28f20685bfda1a27c07983c14768c)

> Also, the splinemesh making up the  
> connection line doesn’t update with  
> the waypoint actor movement.

This is normal and does not happen automatically. You’d need to udpdate the **Spline Mesh Components** as you move the spline points. The **SMCs** need to be deformed as the spline point movement affects position and tangents. You probably have logic for that already, it just needs to be re-run when a point shifts around; or _after_ you’ve moved that point - if you want it to be more performant.

There’s also the middle ground here. You could recalculate the position and tangents of the affected points only - as in the animation above.

If you’re adding the 10th waypoint, there’s no need to fiddle with waypoints 1-7, but the last 3 may be affected as the spline path changes. If your lines are straight, this may not be necessary, of course.

But you still need to tell the **SMCs** that their spline points have shifted.

---

<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:** [September 16, 2020, 10:41am UTC](https://forums.unrealengine.com/t/how-to-click-drag-move-an-actor-during-runtime-play/471417/6 "2020-09-16T10:41:49Z")

</div>

How do you update it at the moment? It be the matter of connecting it to the Tick update in my example.

---

<div class="post-metadata">

**Author:** ![Pheonix00](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pheonix00](https://forums.unrealengine.com/u/Pheonix00)\
**Post date:** [September 16, 2020, 10:52am UTC](https://forums.unrealengine.com/t/how-to-click-drag-move-an-actor-during-runtime-play/471417/7 "2020-09-16T10:52:13Z")

</div>

Oh that is super cool, yeah thats almost exactly what what I’m trying to implement. Yeah I would like my splinemesh connection lines to shift like yours.

 ![313785-dragimplement1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/1/2/0122ad66887302b2028c0dd5710789a40e911fcc.jpeg)

thats how I am currently implementing your approach inside the waypoint blueprint

---

<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:** [September 16, 2020, 11:00am UTC](https://forums.unrealengine.com/t/how-to-click-drag-move-an-actor-during-runtime-play/471417/8 "2020-09-16T11:00:46Z")

</div>

Don’t want to keep you hanging so I’m just going to say that’s simply not feasible, I’m afraid.

Dozens of screenshots that would probably still make little sense as it’s a small part of a _much_ larger system. That would take hours (a day, even) to clean up, comment and present in a somewhat meaningful way.

* * *

But I can see you’re connecting the spline points already with SMCs - why not just insert that update code where the you Set Actor Location above.

---

<div class="post-metadata">

**Author:** ![Pheonix00](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pheonix00](https://forums.unrealengine.com/u/Pheonix00)\
**Post date:** [September 16, 2020, 11:18am UTC](https://forums.unrealengine.com/t/how-to-click-drag-move-an-actor-during-runtime-play/471417/9 "2020-09-16T11:18:44Z")

</div>

![313798-doubleclicktospawnwaypoint.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/6/9/9699c2007049ae6621d41eb419edfab80de6a7d3.png)

 ![313799-spawnwaypointtoaddsplinepoint.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/f/7/4f713617e953ec74f836cb630ef3764a98b5af8b.jpeg)

 ![313800-splinepointtoaddsplinemesh.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/f/3/6f3577dac48e666dff944d6f29b4c9beb2165f1b.jpeg)

This is my full implementation of adding waypoint to world and creating a spline point, and then adding a splinemesh

---

<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:** [September 16, 2020, 11:30am UTC](https://forums.unrealengine.com/t/how-to-click-drag-move-an-actor-during-runtime-play/471417/10 "2020-09-16T11:30:27Z")

</div>

Here’s a _super rough_ version:

 ![313814-screenshot-2020-09-16-121304.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/2/9/629c5cf8fd80f75ff7ec126d1eac420f33b87850.jpeg)

- the above is separate actor that serves as a manager for spline point manipulation
- each waypoint is an actor (for simplicity’s sake since I’m basing it on the original example - use your own method for adding and keeping track of points)
- we gather all waypoints, clear the spline and create as many SMCs as there are waypoints
- each waypoint actor has a dispatcher that informs the spline manager that a spline is moving:

![313811-waypointmove.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/f/9/3f9788c3a70c870558bdac5a99eb5c1b8ebc33ce.jpeg)

- we get all waypoint locations into an array and feed the spline with those points
- the spline then iterates through its points and deforms each SMCs according the spline’s current shapes set by the points mentioned above
- the dispatcher that informs the spline that things are moving is called then here:

 ![313812-screenshot-2020-09-16-122258.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/4/3/a43cd5af3dcb0b46872ec81b7a21398a8d0dce6c.jpeg)

[![Image from Gyazo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/7/8/778a91bddde3bd141b03bbdfcef3ff4718a97d88.gif)](https://gyazo.com/82e90cbb6c7d9291f76ce59496b8974f)

---

<div class="post-metadata">

**Author:** ![Pheonix00](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pheonix00](https://forums.unrealengine.com/u/Pheonix00)\
**Post date:** [September 16, 2020, 11:52am UTC](https://forums.unrealengine.com/t/how-to-click-drag-move-an-actor-during-runtime-play/471417/11 "2020-09-16T11:52:43Z")

</div>

ok lemme look through this and try to implement it
