WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-16-2007, 07:41 PM
AlyssaK AlyssaK is offline
Member
 
Join Date: Dec 2006
Posts: 16
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.
Reply With Quote
  #2  
Old 01-17-2007, 09:22 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
  #3  
Old 01-17-2007, 03:29 PM
AlyssaK AlyssaK is offline
Member
 
Join Date: Dec 2006
Posts: 16
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.
Reply With Quote
  #4  
Old 01-18-2007, 09:24 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
  #5  
Old 01-18-2007, 04:19 PM
AlyssaK AlyssaK is offline
Member
 
Join Date: Dec 2006
Posts: 16
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.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:24 PM.


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