I want to use "Origin to Geometry" on multiple objects but only move the objects' origins on one axis. How do I do this?


Bounding box center

IIRC center to geometry is also the same as bounding box center.

Test script, finds the bounding box center cog and only translates the z component.

import bpy
from mathutils import Matrix, Vector
context = bpy.context
ob = context.object
me = ob.data

bbox = [Vector(b) for b in ob.bound_box]
cog = sum(bbox, Vector()) / 8

me.transform(Matrix.Translation((0, 0, -cog.z)))

Changing last line to


will move origin to center of bounding box.

| improve this answer | |

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.