other object's position?

Hello. How can I get the position of another object (rather than always using a specific vector 3)?

I don't understand what you mean. Position in Unity is stored as a Vector3 so you must use a Vector3 somehow. There are plenty of ways to get the position. The easiest and probably best would be simply.

`var somePos : Vector3 = otherObject.transform.position`

  • or if you don't want to explicitly declare a variable (Vector3 is a value type so there is no worry about memory allocation) then you could also do:

`FireLaserAtPos(otherObject.transform.position);`

  • If you wanted to get fancy then you could get the objects bounds then go to the center of that.

`var centerOfObject : Vector3 = someObject.renderer.bounds.center;`