# How to spawn mesh and move it to Player location

**URL:** <https://forums.unrealengine.com/t/how-to-spawn-mesh-and-move-it-to-player-location/457174>\
**Category:** Blueprint\
**Tags:** spawn, move-to-location, unreal-engine, question\
**Created:** [October 19, 2019, 7:15pm UTC](https://forums.unrealengine.com/t/how-to-spawn-mesh-and-move-it-to-player-location/457174 "2019-10-19T19:15:21Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![UltimaLink](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UltimaLink](https://forums.unrealengine.com/u/UltimaLink)\
**Post date:** [October 19, 2019, 7:15pm UTC](https://forums.unrealengine.com/t/how-to-spawn-mesh-and-move-it-to-player-location/457174/1 "2019-10-19T19:15:21Z")

</div>

So I’m a noob at unreal engine and I’ve been having trouble with this and I feel like it should be simple. Anyway what I want is on a button click, a mesh will spawn. Right when it is spawned I want it to travel to the player controlled character and then float near his hand. If someone can help me with this, that would be fantastic. Thank You

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 19, 2019, 7:28pm UTC](https://forums.unrealengine.com/t/how-to-spawn-mesh-and-move-it-to-player-location/457174/2 "2019-10-19T19:28:12Z")

</div>

You need to add a ( for instance ) simple sphere mesh to the player hand. Not visible in game, but attached to the hand, so it moves with the hand.

When you’re ready, spawn the new actor and move it to the world location of the sphere actor.

You could use a timeline or vinterp if you want this to happen gracefully.

---

<div class="post-metadata">

**Author:** ![UltimaLink](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UltimaLink](https://forums.unrealengine.com/u/UltimaLink)\
**Post date:** [October 19, 2019, 8:41pm UTC](https://forums.unrealengine.com/t/how-to-spawn-mesh-and-move-it-to-player-location/457174/3 "2019-10-19T20:41:45Z")

</div>

So how exactly do you reference the sphere mesh you put on your character? I can’t seem to find a way to reference the sphere in the level blueprint, or do I put all this information in the actual character blueprint?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 20, 2019, 8:25am UTC](https://forums.unrealengine.com/t/how-to-spawn-mesh-and-move-it-to-player-location/457174/4 "2019-10-20T08:25:06Z")

</div>

Hi - I’m not on a machine with the engine right now so can’t check, but one of two things:

1. You may be able to ‘getplaycharacter’ cast to your kind of character, then access the various components

2. Or, yes, do the whole thing in the character BP, would be pretty normal to do that also.

---

<div class="post-metadata">

**Author:** ![UltimaLink](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UltimaLink](https://forums.unrealengine.com/u/UltimaLink)\
**Post date:** [October 21, 2019, 11:29pm UTC](https://forums.unrealengine.com/t/how-to-spawn-mesh-and-move-it-to-player-location/457174/5 "2019-10-21T23:29:59Z")

</div>

![290722-my-question.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/3/b/d3bcf2ee1d80930285c4f24aa08831f822685987.png)

So the object spawns in the right place, but it’s still not moving to the sphere I put on the character BP. What exactly am I missing?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 22, 2019, 6:25am UTC](https://forums.unrealengine.com/t/how-to-spawn-mesh-and-move-it-to-player-location/457174/6 "2019-10-22T06:25:32Z")

</div>

Are you getting your world/local positions mixed up? I assume MoveComponentTo uses a relative location and you’re giving it world.

Pull a pin from SphereOnPlayer and look for GetRelativeLocation 🙂

---

<div class="post-metadata">

**Author:** ![UltimaLink](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UltimaLink](https://forums.unrealengine.com/u/UltimaLink)\
**Post date:** [October 23, 2019, 4:18am UTC](https://forums.unrealengine.com/t/how-to-spawn-mesh-and-move-it-to-player-location/457174/7 "2019-10-23T04:18:04Z")

</div>

Ah ok. I changed that, but it’s still not working. The projectile spawns, but stays in the position it spawned at. What else could be the issue?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 23, 2019, 11:32am UTC](https://forums.unrealengine.com/t/how-to-spawn-mesh-and-move-it-to-player-location/457174/8 "2019-10-23T11:32:43Z")

</div>

Here’s how I did it:

 ![290890-lerp.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/4/f/a4fa7eb268fa2b9b1fe13d1e8afeaead8c85bca6.jpeg)

I spawned a cube, and then used a timeline to move it to the location of the FP gun. Very similar in concept.

The two things I’m wondering about your setup are:

1. I think you’re doing something weird with MoveComponentTo, because you’re mean to give it a component reference, which you aren’t doing. ( You should be able to just grap a compoent from the list and plug it straight in, but have an ACTOR spawned in the world, which is not a component ).

2. If you the projectile is from the projectile class it wants to move the moment you spawn it, which is not going to help you ability to get it where you want it.

( I know it says ‘sheep’ in class type, but it’s actually a cube, just a left over from another example I did ).

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 23, 2019, 11:34am UTC](https://forums.unrealengine.com/t/how-to-spawn-mesh-and-move-it-to-player-location/457174/9 "2019-10-23T11:34:42Z")

</div>

Also, to avoid you head banging for a few hours, it you want to move it from somewhere other than 0,0,0 you have to put the start location in a variable and give it to the lerp as that variable ( ie, fixed ).

Using a GetActorLocation plugged into the lerp will give you just more weirdness…

---

<div class="post-metadata">

**Author:** ![UltimaLink](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UltimaLink](https://forums.unrealengine.com/u/UltimaLink)\
**Post date:** [October 29, 2019, 11:38pm UTC](https://forums.unrealengine.com/t/how-to-spawn-mesh-and-move-it-to-player-location/457174/10 "2019-10-29T23:38:25Z")

</div>

So I tried your example out. It’s doing the same thing unfortunately. It’s spawning, but not moving. I really don’t know if it’s something in the actor that is spawning, something in the timeline, or the object it is supposed to move to. It’s a little weird and a bit frustrating. Any idea what it could be?

I also wanted to say Thank You for helping me. I’m sorry if I’m being annoying or anything, I’m not that great at Unreal yet and just needed help. So thank you 🙂

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 30, 2019, 12:10pm UTC](https://forums.unrealengine.com/t/how-to-spawn-mesh-and-move-it-to-player-location/457174/11 "2019-10-30T12:10:43Z")

</div>

No worries. Have you tried spawning a different actor, like just a plain cube?..

---

<div class="post-metadata">

**Author:** ![UltimaLink](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UltimaLink](https://forums.unrealengine.com/u/UltimaLink)\
**Post date:** [November 1, 2019, 3:54am UTC](https://forums.unrealengine.com/t/how-to-spawn-mesh-and-move-it-to-player-location/457174/12 "2019-11-01T03:54:27Z")

</div>

So I tried switching different actors and it kinda works the way I want it to. It moves toward me now, but it moves to a spot in mid air above the player and moves around with the player. I want it to move to the hand, stay in that relative location, and move with the player whenever they move. Is this something I change in the timeline or is this something different overall?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [November 1, 2019, 8:23am UTC](https://forums.unrealengine.com/t/how-to-spawn-mesh-and-move-it-to-player-location/457174/13 "2019-11-01T08:23:48Z")

</div>

Once you’ve moved it to the hand ( I know we’re not there yet… ) then you need to attach it to a socket. Otherwise you have to spend the whole time moving it on tick, not pretty.

I really don’t know what you have going on, the strange movement still sounds like you’re getting world / relative and Add / Set nodes mixed up. To be clear this should only be WORLD location and SET.

If you want to put just the trouble areas in a small project and give me a link I’ll take a look. You do that like this:

1. Make a new project, no starter content

2. In you old project right click on anything that needs to be transferred and choose ‘asset actions → migrate’ and choose the content folder of your new project.

3. Then you can just zip the new project folder ( from windows explorer ) and put it on google drive, or wherever.

---

<div class="post-metadata">

**Author:** ![UltimaLink](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UltimaLink](https://forums.unrealengine.com/u/UltimaLink)\
**Post date:** [November 6, 2019, 3:13am UTC](https://forums.unrealengine.com/t/how-to-spawn-mesh-and-move-it-to-player-location/457174/14 "2019-11-06T03:13:57Z")

</div>

So i actually tried the move to component node again, and it’s actually working now! Thanks so much for your help.

I only have one more question. Is it possible to make the object that moves toward the player hover or play an animation when it’s attached to the player?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [November 6, 2019, 8:02am UTC](https://forums.unrealengine.com/t/how-to-spawn-mesh-and-move-it-to-player-location/457174/15 "2019-11-06T08:02:07Z")

</div>

Sure it is, but that’s a separate thing really 😉

The thing you spawn can be a BP, and that BP can play an animation when it’s near the player. It also, most likely, would be a particle system ( I’m imagining magic casting etc ).
