Forum

Parenting lost with copy() ?

24 November 2015 18:47
Hi,

I am observing that when you copy a parented object (here to the camera) using the API, the newly created object doesn't behave as the source object, as if the parenting relation was lost.

Yet the get_parent() method from the objects module still reports it is.

But another troubling thing is that the vector yielded by get_translation_rel() used on the new object now adopts the value of get_translation(). Like if the world space coordinates are now the relative coordinates.

25 November 2015 12:20
Hi.

But another troubling thing is that the vector yielded by get_translation_rel() used on the new object now adopts the value of get_translation().

The copied object has a parent from original object, but it has no constrains. When you call get_translation_rel(), it returns the copied object coordinates in the world space, if the object has no constrains.

If you want to save the original objects and his parent interconnection, you should append new constrain. Take a look at the "constraints" module, please. I think, that the "append_stiff_trans_rot" function do the trick.
 
Please register or log in to leave a reply.