how to access the Transform of a moving child object?
I have an FPS controller with an empty child called "BulletSpawn", which is supposed to serve as the spawn points for instantiated projectiles. When I instantiate a projectile and set its position and rotation equal to "BulletSpawn", I do not get the intended result. This is because the transform of "Bulletspawn" under the inspect does not update at all. It moves correctly in relation to the parent FPS controller, but its transform values do not change while moving across the map. I have tried a couple different solutions and have a couple more ideas but I believe there should be a simple and clean solution to this. Please let me know if you can help because I'm approaching a deadline! according to the documentation, transform.position is the global/absolute transform value, and yet this does not seem to be the case, since transform/position and transform.rotation values stay the same in the inspector while moving all over the map. Is this a bug or am I missing something?
hayk
If i'm not wrong, the transform component in the inspector of your child is displaying relative position/rotation to your parent object. When you attach objects to other objects, the transform component displays the relative position/rotation to its parent.
Answer by TKDHayk · Jun 15, 2016 at 02:10 AM
Perhaps, you mean transform of a child is actually localtransform? Is there a way to access the global transform of a child?
I'm not really sure because i'm still kind of new to this, perhaps if you post the part of your script that you are using to instantiate the object, it would be clearer what is the problem you have with spawning.
Your answer
Follow this Question
Related Questions
Firing projectile from Transform. What am I doing wrong? 1 Answer
reset a GameObject parents childs to 0 if a item has changed its parent 2 Answers
Following object (arrow) slides off of a object 1 Answer
How to change rotation for a FirstPersonController through script. 0 Answers
Gameobject transform not moving when doing animation 0 Answers