Quantcast
Channel: Latest Questions by gdbjohnson
Viewing all articles
Browse latest Browse all 24

Setting the transform.position not working

$
0
0
I'm a bit confused as to what's happening here. The position of my transform is not changing despite me setting it to a zero vector. Here's the code. Any ideas why this change isn't taking? Vector3 v = new Vector3(0, 0, 0); GameObject o = Instantiate (_playerItem.PlayerWeapon.WeaponPrefab, v, transform.rotation) as GameObject; o.transform.parent = weaponContainer.transform; o.transform.position = v; The gameobject is a prefab object. It loads correctly, however it looks like the position of the vector is takes is an offset to the parent transform to achieve a zero vector. That is, summing o.transform.position and o.transform.parent.position gives a zero vector. Why? And, how can I make it's position be a zero vector?

Viewing all articles
Browse latest Browse all 24

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>