WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 05-21-2014, 01:45 PM
The SundanceKid The SundanceKid is offline
Member
 
Join Date: May 2014
Posts: 4
Changing parent without changing absolute global position?

Hi,

I'm trying to set an object's parent without changing its global absolute position.

Whenever I set the object's parent, its position resets to [0, 0, 0] on its parent's relative coordinate system (its position becomes the same as its parents position).

How do I get around this? I have tried many things, such as finding the object's position on the absolute global coordinate system, setting the object's parent, and then setting the object's position back to the one I found earlier. This doesn't seem to work.

Another seemingly easy way to do this would be to find the object's position relative to its soon-to-be parent's position, but I can't do this because they are not in the same hierarchy—I have to subtract both positions on the absolute global coordinate system. Then, of course, I set the object's parent and move it back to the correct position that I just went through the work of finding.

All of these ways don't work.

How do I set and object's parent without changing it's global position?

Last edited by The SundanceKid; 05-21-2014 at 01:53 PM.
Reply With Quote
  #2  
Old 05-21-2014, 02:04 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Getting the global position before re-parenting and restoring it after should work. Can you post the code you are using?
Reply With Quote
  #3  
Old 05-23-2014, 02:43 PM
The SundanceKid The SundanceKid is offline
Member
 
Join Date: May 2014
Posts: 4
Quote:
Originally Posted by farshizzo View Post
Getting the global position before re-parenting and restoring it after should work. Can you post the code you are using?
I have done this and it restores the position correctly, but it appears that the object is no longer parented to the correct one anymore. After restoring the position it appears that the object is parented to the world, rather than the object I want it to be parented to.

I'm sorry, but I am not allowed to post any of the code.

Thanks for the help.

Last edited by The SundanceKid; 05-23-2014 at 02:45 PM. Reason: I forgot to include a quote of what farshizzo posted.
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 02:14 AM.


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