Question by
Mschri · Jul 18, 2017 at 03:37 AM ·
scripting problemgameobjectraycastraycastingempty game object
RayCasting from a Empty GameObject
Hello,
Does anybody here know how to assign empty gameobject's coordinates to a script rather than setting it up in the inspector? For instance, I want to shoot a raycast from a gun barrel. Problem is I want the script to know where the coordinates is before I save the script.
I do not want to assign this in the inspector because I have to keep reassigning it to the script everytime I run the game. Would tags help for this? If so, how can I use it to assign the coordinates of the empty game object?
Thanks!
Comment
Answer by Major · Jul 18, 2017 at 06:12 AM
transform.position will get you the current world position of the object the script is applied to.