# Wrong world position

**URL:** https://discussions.unity.com/t/wrong-world-position/595716
**Category:** Scripting
**Tags:** Scripting
**Created:** [August 31, 2015, 6:51pm UTC](https://discussions.unity.com/t/wrong-world-position/595716 "2015-08-31T18:51:46Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Nihil688](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/nihil688/32/586635_2.png) [@Nihil688](https://discussions.unity.com/u/Nihil688)
#### Post date: [August 31, 2015, 6:51pm UTC](https://discussions.unity.com/t/wrong-world-position/595716/1 "2015-08-31T18:51:46Z")

</div>

Dunno if anyone else had this but when I parent a object on a humanoid animated character, the “transform.position” returns the wrong position ( tested in 5.1.3 ).

If I pause the editor, unparent and redebug it says the right position but as long as it’s parented it wont, any ideas?

---

<div class="post-metadata">

### Author: ![Kiwasi](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/kiwasi/32/351502_2.png) [@Kiwasi](https://discussions.unity.com/u/Kiwasi)
#### Post date: [August 31, 2015, 8:39pm UTC](https://discussions.unity.com/t/wrong-world-position/595716/2 "2015-08-31T20:39:12Z")

</div>

You aren’t looking for transform.localPosition instead?

---

<div class="post-metadata">

### Author: ![Nihil688](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/nihil688/32/586635_2.png) [@Nihil688](https://discussions.unity.com/u/Nihil688)
#### Post date: [September 1, 2015, 10:38am UTC](https://discussions.unity.com/t/wrong-world-position/595716/3 "2015-09-01T10:38:09Z")

</div>

I want to instantiate a bullet at the tip of a gun and when that gun is parented to the hand of the character the world position is wrong and the bullet gets instantiated at the center of his body instead. If I unparent it then the world position works fine

---

<div class="post-metadata">

### Author: ![Nihil688](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/nihil688/32/586635_2.png) [@Nihil688](https://discussions.unity.com/u/Nihil688)
#### Post date: [September 1, 2015, 3:20pm UTC](https://discussions.unity.com/t/wrong-world-position/595716/4 "2015-09-01T15:20:24Z")

</div>

I fixed it with a hack by adding a monobehaviour on the tip and stored the position in a variable, that way it provides the correct position information, someone has to look into this one…

---

<div class="post-metadata">

### Author: ![Suddoha](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/suddoha/32/110358_2.png) [@Suddoha](https://discussions.unity.com/u/Suddoha)
#### Post date: [September 1, 2015, 3:38pm UTC](https://discussions.unity.com/t/wrong-world-position/595716/5 "2015-09-01T15:38:26Z")

</div>

> [@Nihil688](#):
>
> I fixed it with a hack by adding a monobehaviour on the tip and stored the position in a variable, that way it provides the correct position information, someone has to look into this one…

I tried to reproduce this behaviour but everything worked as it should.

---

<div class="post-metadata">

### Author: ![Kiwasi](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/kiwasi/32/351502_2.png) [@Kiwasi](https://discussions.unity.com/u/Kiwasi)
#### Post date: [September 1, 2015, 8:38pm UTC](https://discussions.unity.com/t/wrong-world-position/595716/6 "2015-09-01T20:38:56Z")

</div>

> [@Nihil688](#):
>
> I want to instantiate a bullet at the tip of a gun and when that gun is parented to the hand of the character the world position is wrong and the bullet gets instantiated at the center of his body instead. If I unparent it then the world position works fine

Sounds like you are simply grabbing the wrong transform.

---

<div class="post-metadata">

### Author: ![Nihil688](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/nihil688/32/586635_2.png) [@Nihil688](https://discussions.unity.com/u/Nihil688)
#### Post date: [September 2, 2015, 10:31am UTC](https://discussions.unity.com/t/wrong-world-position/595716/7 "2015-09-02T10:31:37Z")

</div>

@Suddoha how do you create the weapon in the hand? If you have done this with a monobehaviour then it’ll have the correct result as my solution which aren’t an answer as to why transform.position doesn’t work at all times

@Kiwasi I have the object and I do .transform.position, I don’t see how this can be wrong, also when I’m unparenting on the same second without changing any code the result is correct.

---

<div class="post-metadata">

### Author: ![Suddoha](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/suddoha/32/110358_2.png) [@Suddoha](https://discussions.unity.com/u/Suddoha)
#### Post date: [September 2, 2015, 6:32pm UTC](https://discussions.unity.com/t/wrong-world-position/595716/8 "2015-09-02T18:32:21Z")

</div>

> [@Nihil688](#):
>
> @Suddoha how do you create the weapon in the hand? If you have done this with a monobehaviour then it’ll have the correct result as my solution which aren’t an answer as to why transform.position doesn’t work at all times
> 
> @Kiwasi I have the object and I do .transform.position, I don’t see how this can be wrong, also when I’m unparenting on the same second without changing any code the result is correct.

I simply created 2 objects, one being the child of the other. I placed them manually. The only thing i’ve done with scripts is a Debug.Log() and it always prints the position to the console that i expect.  
Sorry if i misunderstood something.  
Maybe you could add some pictures/screenshots and your script?
