How do i get a location copy?

when i run this code:

ob = bpy.context.active_object   
point = ob.location
print (point)
offset = 5
ob.location[1] = ob.location[1] + offset
print (point)

i get Vector (0.0000, 0.0000, 0.0000)
the first time i run the print command and
Vector (0.0000, 5.0000, 0.0000)
the second time.

i want a copy of the location Not a reference.

Quite simply:

point = ob.location.copy()

1 Like

thanks should have tried that but i didn’t because when i wrote C.active_object.location in the console i only got xyzw and all the other possible combinations of xyzw

you can use import copy copy.copy(loc)

I also figured that if you wrap it in a Vector class you get a copy of it as well.


Or sometimes:
Import copy