WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   getPosition coordinates (https://forum.worldviz.com/showthread.php?t=979)

AlyssaK 01-16-2007 07:41 PM

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.

farshizzo 01-17-2007 09:22 AM

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.

AlyssaK 01-17-2007 03:29 PM

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.

farshizzo 01-18-2007 09:24 AM

The following code should do what you are asking for:
Code:

x,y,z = object1.getPosition()

object2.setPosition(x,y+10,10)

Let me know if I still misunderstood your question.

AlyssaK 01-18-2007 04:19 PM

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.


All times are GMT -7. The time now is 02:59 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC