I need to make an image in which there are two objects when one of them is located regularly on the plane but the second is actually a bit on top of the first one when they do not touch each other. It is actually not realistic because the second object is hung in the 'air' without any support. For example, in the attached image, the sphere is located (not realistically) on top of the cube. I tried to use the function of bpy.ops.transform.translate(value=(x, y, scale)), but none of its parameters controls the height of objects. Do you have an idea how can I make it?

enter image description here

  • $\begingroup$ Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. $\endgroup$
    – cnisidis
    Dec 6, 2021 at 13:43

1 Answer 1


Just a cheap solution:

import bpy

# need 'Cube' and 'Sphere' 
cube = bpy.data.objects['Cube']
sphere = bpy.data.objects['Sphere']

for idx in range(3):
    sphere.location[idx] = cube.location[idx]   # loc x,y,z is same

sphere.location[2] += (cube.dimensions[2]/2) + (sphere.dimensions[2]/2) # move sphere to top of cube
  • $\begingroup$ Thank you very much! it is exactly what I needed. $\endgroup$
    – DaveNuk
    Dec 7, 2021 at 15:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .