# UI widget always spawns at World Location 0,0 and not at the desired position.

**URL:** <https://forums.unrealengine.com/t/ui-widget-always-spawns-at-world-location-0-0-and-not-at-the-desired-position/1151715>\
**Category:** Blueprint\
**Tags:** unreal-engine, Widget, Blueprint, question\
**Created:** [May 2, 2023, 10:15am UTC](https://forums.unrealengine.com/t/ui-widget-always-spawns-at-world-location-0-0-and-not-at-the-desired-position/1151715 "2023-05-02T10:15:43Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![DiliupG](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/diliupg/32/1071099_2.png) [@DiliupG](https://forums.unrealengine.com/u/DiliupG)\
**Post date:** [May 2, 2023, 10:15am UTC](https://forums.unrealengine.com/t/ui-widget-always-spawns-at-world-location-0-0-and-not-at-the-desired-position/1151715/1 "2023-05-02T10:15:43Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/8/7/587575ef582b1438cdb678b3327d5c5c2541fc38.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/0/1/601aa3ffd9b280ed57fc39ad0a85d2738c8b3011.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/c/f/0cf3c70e2bde199c1c99a7ea73c09f82aa6dc86f.png)

The code for creating the code, the user event code and calling the code is depicted above. But in the game, the widget is always spawned a world location 0,0. Can someone please help me.

---

<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:** [May 2, 2023, 10:36am UTC](https://forums.unrealengine.com/t/ui-widget-always-spawns-at-world-location-0-0-and-not-at-the-desired-position/1151715/2 "2023-05-02T10:36:12Z")

</div>

Instead of Render Translation, set the position in the viewport directly:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/9/f/c9f9c3177a95389b9da82569f3f883e8a50e5ecf.png)

If you do not provide a value, it will default to **screen** location 0,0.

* * *

The animation could use Render Translation in order to nudge the widget around.

---

<div class="post-metadata">

**Author:** ![DiliupG](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/diliupg/32/1071099_2.png) [@DiliupG](https://forums.unrealengine.com/u/DiliupG)\
**Post date:** [May 2, 2023, 2:10pm UTC](https://forums.unrealengine.com/t/ui-widget-always-spawns-at-world-location-0-0-and-not-at-the-desired-position/1151715/3 "2023-05-02T14:10:12Z")

</div>

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

I did what you asked. Here is the code. No change. Still the widget is spawned at world 0,0.

---

<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:** [May 2, 2023, 2:11pm UTC](https://forums.unrealengine.com/t/ui-widget-always-spawns-at-world-location-0-0-and-not-at-the-desired-position/1151715/4 "2023-05-02T14:11:41Z")

</div>

Add to viewport first, only then `Set Position`. I’ve updated the image to avoid confusion, my bad.

Also, ensure the widget has no canvas, as this could offset any hierarchy.

* * *

You’re making something similar to:

> [@Damage displayed](https://forums.unrealengine.com/t/damage-displayed/99716/3):
>
> Or use a widget: The widget is quite plain. You can add colours, crit sfx, alter font size, add outlines and so on. [widget.png] On Construct you position it in the viewport via an exposed variable and you set a target location for it to move towards to. The fading animating starts playing immediately. Event Tick will update its position. The animation changes text’s opacity from 1 to 0 over 1s and once it’s over, the widget gets removed from the viewport and garbage coll…

Right?

---

<div class="post-metadata">

**Author:** ![DiliupG](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/diliupg/32/1071099_2.png) [@DiliupG](https://forums.unrealengine.com/u/DiliupG)\
**Post date:** [May 2, 2023, 2:54pm UTC](https://forums.unrealengine.com/t/ui-widget-always-spawns-at-world-location-0-0-and-not-at-the-desired-position/1151715/5 "2023-05-02T14:54:01Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/4/b/94bc76f2d7a9845f9b3ddb82936ac7e46052008c.png)

@Everynone, I found the error and thought of sharing it with you, who were so kind to respond.  
You can see in the image above that I am taking the impact location from the impact point, whereas previously I had taken it from the Impact normal (which is not visible in the image I shared). Now all is OK. I only changed that, and everything else is as you see above.  
Thank you for your kindness.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/c/6/bc61fcce55714cd8e5ab7d176c00031821689ae1.png)

This is the code with the complete function.

---

<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:** [May 2, 2023, 3:17pm UTC](https://forums.unrealengine.com/t/ui-widget-always-spawns-at-world-location-0-0-and-not-at-the-desired-position/1151715/6 "2023-05-02T15:17:15Z")

</div>

No probs.

* * *

Not sure if relevant but for future reference, in case you did not know, UE has an interface based native damage system:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/8/0/5802be31b28b7286bd4e0d8a285f75621bff7df2.png)

Which can also be further extended with Damage Type classes. Perhaps there’s no need to re-invent the wheel.

Good luck!

---

<div class="post-metadata">

**Author:** ![DiliupG](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/diliupg/32/1071099_2.png) [@DiliupG](https://forums.unrealengine.com/u/DiliupG)\
**Post date:** [May 2, 2023, 5:19pm UTC](https://forums.unrealengine.com/t/ui-widget-always-spawns-at-world-location-0-0-and-not-at-the-desired-position/1151715/7 "2023-05-02T17:19:35Z")

</div>

@Everynone! I didn’t know that! So how would one go about doing that? Can I add damage per bone?

---

<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:** [May 2, 2023, 5:44pm UTC](https://forums.unrealengine.com/t/ui-widget-always-spawns-at-world-location-0-0-and-not-at-the-desired-position/1151715/8 "2023-05-02T17:44:48Z")

</div>

Oh yeah, have a look at thread:

> [@Heath Bar for Different limbs](https://forums.unrealengine.com/t/heath-bar-for-different-limbs/238988/3):
>
> So I played with this and got here: Found a neat way to map widgets onto the physics asset. How close is this to what you need?

---

<div class="post-metadata">

**Author:** ![DiliupG](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/diliupg/32/1071099_2.png) [@DiliupG](https://forums.unrealengine.com/u/DiliupG)\
**Post date:** [May 2, 2023, 6:36pm UTC](https://forums.unrealengine.com/t/ui-widget-always-spawns-at-world-location-0-0-and-not-at-the-desired-position/1151715/9 "2023-05-02T18:36:33Z")

</div>

@Everynone, That’s really great! Would you share that, please?

---

<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:** [May 2, 2023, 7:05pm UTC](https://forums.unrealengine.com/t/ui-widget-always-spawns-at-world-location-0-0-and-not-at-the-desired-position/1151715/10 "2023-05-02T19:05:30Z")

</div>

Look at the thread. Everything is there, the entire project is attached.

---

<div class="post-metadata">

**Author:** ![DiliupG](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/diliupg/32/1071099_2.png) [@DiliupG](https://forums.unrealengine.com/u/DiliupG)\
**Post date:** [June 4, 2023, 5:47pm UTC](https://forums.unrealengine.com/t/ui-widget-always-spawns-at-world-location-0-0-and-not-at-the-desired-position/1151715/11 "2023-06-04T17:47:04Z")

</div>

The numbers have to spawn at the hit location on the body. That’s why I used render translation. I will try what you suggest. Is doing render translation more expensive than what you suggest?
