2
$\begingroup$

My code is:

human_obj=bpy.data.objects["Armature"]

When I scale it with the command human_obj.scale=(1,1,1) the object remains at its original location. However, when I scale it with factors (1,2,1) or (2,1,1), the object will move to a new coordinate location based on the amount of scaling I've done in the x or y axis.

How can I scale the object so that it stays in the same location after scaling? It does not matter if I do this scaling in edit mode. When I return to object mode, it will jump to a new location for any scaling of x or y != 1

$\endgroup$
3
$\begingroup$

Your pivot center point is the only point that is unchanged when scaling. By default this pivot center point is the object origin. In order for your human object to not move, the center point must be either at the foot or at the barycenter of it (it depends on what you mean by "remain at its original location")

To do that you can use the 3d cursor as the pivot point and set its location to the point unchanged point (foot or barycenter)

bpy.context.area.spaces[1].pivot_point='CURSOR'
bpy.context.scene.cursor_location = pos #where pos is the unaltered point
$\endgroup$
0
$\begingroup$

One possible explanation is that the original center of your mesh was changed. This happen when you move your mesh WHILE in edit mode. Try to use the command line with a simple cube to see if you have same issue.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.