#1
|
|||
|
|||
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 02:53 PM. |
#2
|
|||
|
|||
Getting the global position before re-parenting and restoring it after should work. Can you post the code you are using?
|
#3
|
|||
|
|||
Quote:
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 03:45 PM. Reason: I forgot to include a quote of what farshizzo posted. |
|
|