#1




getPosition coordinates
Hi everyone,
I'd like to find out the exact coorindates of a given object in order to insert other objects relative to this position. I've looked at all the get methods. getPosition returns the x,y,z how could i find out each of these seperately? Is there a method that i've overlooked? Just wanted to post a quick question before i went ahead with parsing the output of getPosition. Thanks. 
#2




I'm not exactly sure what you are needing. getPosition() will return the exact (x,y,z) coordinates of the objects local origin. Is the object underneath a hierarchy of other objects? If so, then you will need to call getPosition(viz.ABS_GLOBAL) to get the true world coordinates of the object.

#3




Sorry i don't think i explained the question clearly.
getPosition does return the x,y,z coordinates. What i am looking for is to set the position of a second or third object etc. relative to the position of the first object. i.e. First object getPosition returns (2,5,10) then x = 2, y = 5, z = 10 Second object setPosition(x, y+10, 10) I'd like to find the values of x, y, and z seperately so that i can implement the above. Thanks for your post. 
#4




The following code should do what you are asking for:
Code:
x,y,z = object1.getPosition() object2.setPosition(x,y+10,10) 
#5




Thankyou that is exactly what i was after!
I just assumed you needed to call a different function to retrieve each of the coordinates seperately. 
Thread Tools  
Display Modes  Rate This Thread 

