Hi I have created custom module. Now i want to get the object position at runtime when i rotate the object.
new Vector3(object.transform.position.x,object.transform.position.y,object.transform.position.z)
Object is the custom object of which i want to get the position at runtime and move another object to that position.
Heya 
I might have misunderstood the question, but I think you want to move one object to another object’s position. To do this, you could try:
otherObject.transform.position = object.transform.position;
“otherObject” would be the object you’re trying to move to "object"s position.
If you just want to get "object"s position and store that in a Vector3,
Vector3 objectPosition = object.transform.position;
Hi @HawkSandwich Thank you for your reply.
Yes you are right i want to move one gameObject to another. I achieved this.
But i want to GameObject (lets say CUBE) to another gameObject(which will have layers in it, it is a custom object). I want to get the position of a particular layer runtime and move my cube to that position.
I am new to Unity and i got the GameObject from client and this has layers in it and each layer has position(0,0,0). If i try to give position of a particular to the Cube to move. It is moving to (0,0,0). In inspector also the position is (0,0,0).
(0,0,0) is the starting point of that layer(object). I want to move the cube to the other end of that layer.
Hi @rakesh_26,
Moving a gameobject has different ways, assume you want to move it smoothly, not “teleporting” your gameobject.
GameObject (which it’s position is to be referred) is called “Object”
GameObject (which will move to the “Object”) called ObjectToBeMoved
using UnityEngine;
float movementSpeed;
void Start(){
Vector3 myTargetPosition = GameObject.Find("Object").transform.position;
}
void Update(){
transform.position = Vector3.MoveTowards(transform.position,myTargetPosition,movementSpeed*Time.deltaTime);
}
See Vector3.MoveTowards
for teleporting, you can put it in other method (not Update() )since it only need to be called once unless you want the ObjectToBeMoved to keep following the “Object” every frame :
transform.position = new Vector3 (myTargetPosition.x ,myTargetPosition.y ,myTargetPosition.z);