- Home /
Question by
Spaceman1701 · Dec 28, 2011 at 05:24 AM ·
javascriptobjectlocationcreate
Create an Object at a X,Y,Z location on the fly
Hi,
I am having a problem creating an object at a given XYZ location using JavaScript. How could I do this?
Comment
Answer by asafsitner · Dec 28, 2011 at 06:30 AM
Example (from the documentation):
var prefab : Transform;
Instantiate (prefab, Vector3(x, y, z), Quaternion.identity);
Ok, thanks. Also, how can I find the location and rotation of another game object?
GameObject.Find("NameOfOtherObject").transform.rotation
Same with position.
Ok, Thanks. Unity just lost a couple of my prefabs, so I have no idea if any of this will work, but I am guessing it will.