hello, i'm back after two years, starting a new game project, last unity version i had used was unity 2016. now i'm using unity 2019 and i'm learning about the changes made in unity in these two years. i'm facing an issue, maybe a newbie one, i'm trying to instantiate a bullet at some empty child from my prefab gameobject transform, but when i move my master object and try to instantiate the bullet again it keep instantiate at 0,0,0 these is the code i used to instantiate my bullet any help will be very useful thanks in advance for all your help. Code (csharp): if (Time.time > delay) { Rigidbody bullet = (Rigidbody)Instantiate(BulletPrefab, WeaponFireLocation.transform.localPosition, Quaternion.identity); bullet.AddForce(WeaponFireLocation.forward * 1000); delay = Time.time + attack_rate; } p.s.: all variables and object are valid, not empty or null variables are in the code.
1. This is the wrong place for questions as far as forum placement. 2. I think you need to read up on the difference between world and local coordinates. You are instantiating the bullet at the "local" position of a transform....but the instantiate function needs world coordinates. You can do a conversion, but I don't think you need that in this case since you have access to the object. You can directly grab the world coordinates.
sorry for posting in the wrong section, i will post in the right place next time. thanks for the info, i will try that!