# Spawning coins on top of obstacles \[UE5-0\]

**URL:** <https://forums.unrealengine.com/t/spawning-coins-on-top-of-obstacles-ue5-0/562320>\
**Category:** Blueprint\
**Tags:** unreal-engine, UE5-0, question, Blueprint\
**Created:** [May 20, 2022, 10:03pm UTC](https://forums.unrealengine.com/t/spawning-coins-on-top-of-obstacles-ue5-0/562320 "2022-05-20T22:03:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fekoh17](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fekoh17/32/487751_2.png) [@Fekoh17](https://forums.unrealengine.com/u/Fekoh17)\
**Post date:** [May 20, 2022, 10:03pm UTC](https://forums.unrealengine.com/t/spawning-coins-on-top-of-obstacles-ue5-0/562320/1 "2022-05-20T22:03:08Z")

</div>

So i’m creating an endless runner in ue5, and i want some of my coins to spawn on top of the obstacles that i created, pls how do i do that. I only got experience in web development and still new to unreal engine. This is the event graph for the coins

 ![Screenshot (32)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/2/4/72438801089b5233fbf7bc14b161c7f2d644ea44.png)  
and this is the function for spawning coins on my floor tiles like the floor the character runs on, the class for coins is the extreme bottom.PS: the blueprints for spawning are for the first lane  
 ![Screenshot (33)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/9/5/b9531060b6228e216615f993499f81cc3ab53a43.png)  
There’s no functionality for my obstacle, it just being spawned by the main tiles  
 ![Screenshot (34)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/8/c/88cd54102066bb52763fa5e7bea1155210459b41.png)

---

<div class="post-metadata">

**Author:** ![aMustachedPotato](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/amustachedpotato/32/953940_2.png) [@aMustachedPotato](https://forums.unrealengine.com/u/aMustachedPotato)\
**Post date:** [May 21, 2022, 12:20am UTC](https://forums.unrealengine.com/t/spawning-coins-on-top-of-obstacles-ue5-0/562320/2 "2022-05-21T00:20:31Z")

</div>

You can get the world Z location of the plane and add the amount of offset you would like

---

<div class="post-metadata">

**Author:** ![Fekoh17](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fekoh17/32/487751_2.png) [@Fekoh17](https://forums.unrealengine.com/u/Fekoh17)\
**Post date:** [May 24, 2022, 9:19pm UTC](https://forums.unrealengine.com/t/spawning-coins-on-top-of-obstacles-ue5-0/562320/3 "2022-05-24T21:19:02Z")

</div>

Can you simplify a bit further

---

<div class="post-metadata">

**Author:** ![aMustachedPotato](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/amustachedpotato/32/953940_2.png) [@aMustachedPotato](https://forums.unrealengine.com/u/aMustachedPotato)\
**Post date:** [May 24, 2022, 10:30pm UTC](https://forums.unrealengine.com/t/spawning-coins-on-top-of-obstacles-ue5-0/562320/4 "2022-05-24T22:30:51Z")

</div>

Get the mesh reference (like the one you showed in the picture) but search for “get world location”. Once you have the world location of the mesh right click the vector pin to get the X, Y, and Z as floats. Drag off of the Z float and add 100, get the coin blueprint and set the world z location to the new float.

---

<div class="post-metadata">

**Author:** ![Fekoh17](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fekoh17/32/487751_2.png) [@Fekoh17](https://forums.unrealengine.com/u/Fekoh17)\
**Post date:** [May 25, 2022, 1:05pm UTC](https://forums.unrealengine.com/t/spawning-coins-on-top-of-obstacles-ue5-0/562320/5 "2022-05-25T13:05:08Z")

</div>

Ive gotten the mesh reference, in this case D, i got the world location, but how do i add 100 to the z pin, when it shows return value Z, do i use the add node? ive gotten the coin blueprint.

 ![Screenshot (36)](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/b/1/4b10c7349c88b55b721ab2ca4f4a11a399236924.png)  
what do i hook up to return value z

---

<div class="post-metadata">

**Author:** ![Grot13](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/grot13/32/1008648_2.png) [@Grot13](https://forums.unrealengine.com/u/Grot13)\
**Post date:** [May 25, 2022, 4:27pm UTC](https://forums.unrealengine.com/t/spawning-coins-on-top-of-obstacles-ue5-0/562320/6 "2022-05-25T16:27:35Z")

</div>

Hello, you can right click on the orange pin and choose “split struct pin”. It will split the transform pin into location, rotation and scale. Repeat the operation on the location pin and you will have your three floats exposed.  
Then you just have to use a “add (float)” node to add 100 to your return Z value
