1
$\begingroup$

enter image description here

I have a unfolding object here I created using the Origamify add on. this add on allows me to fold and unfold this object and I need to keep that. If I move the origin point folding mechanism no longer works. So far I can snap the object to the plane but it won't snap flat it only snaps at a 90 degree angle, or the original angle the object was created at. If I'm only unfolding a cube that's not a big deal because I can manually rotate the object. But if I have a more complex model with a complicated angle from the object to the origin point, I can't get the flat series of objects to snap to the base plane. https://youtu.be/ZLkyWGQ-_2I
this videos show the intended result. basically I need a way to snap one plane to another where the entire object rotates according to moving planes movement.

$\endgroup$
2
$\begingroup$

A number of ways of doing this, but here's one that should preserve all the relationships in your origami. It looks from your picture as if all the folding parts of the model are separate objects, with their origins on the folds, all parented to a static part, with its origin off-plane.

In brief: parent the existing origami-hierarchy to another object aligned to, and in its plane. Then snap the new parent.

Not so brief, and assuming the worst case, with the origami and the target plane both skew to the world and their own object-axes:

enter image description here

  • With the T > 3D Cursor tool active, and its N > Tool tab options set to 'Surface Project' and Orientation 'Geometry', drag the cursor to somewhere on the static section of your origami. -ShiftACreate an Empty there, and in its adjustment panel, set its 'Align' to '3D Cursor'
  • CtrlP parent the static section to the Empty.

enter image description here

  • If the plane you are aiming at is skew to the world, create a Transform Orientation from its face in Edit Mode by selecting it and clicking the little '+' in the Header's Transform Orientation dropdown. (You won't need to, if the target plane is in World XY.)
  • With the Empty selected, Header > Object Menu > Transform > Align to Transform Orientation, with the newly created orientation selected. Your origami should now be aligned to the plane.
  • Snap the Empty to the plane, any way you choose
  • AltP un-parent your origami from the Empty, with 'Clear and Keep Transformation'.

This really is the worst case: if your origami's local axes are aligned to their planes, or the target plane is aligned to the world, you can skip some of these steps.

$\endgroup$
2
  • $\begingroup$ This worked. Unfortunately this project is definitely worst case scenario. Thank you tons though! $\endgroup$ – Graham Thomas Feb 16 at 22:14
  • $\begingroup$ I am learning to script in python to automate this project Is the a script option that could perform this action? stackoverflow.com/questions/42893410/… I am curious if I could get the rotation of the plane I could then apply that to rotate it flat. $\endgroup$ – Graham Thomas Mar 3 at 22:59
0
$\begingroup$

I was able to piece together this code. It is a much faster solution.

import bpy
from mathutils import Matrix, Vector

def scale_from_vector(v):
    mat = Matrix.Identity(4)
    for i in range(3):
        mat[i][i] = v[i]
    return mat    


o2 = bpy.data.objects['Cubeface002']
face  = o2.data.polygons[0] 

loc_dst, rot_dst, scale_dst = o2.matrix_world.decompose()

q = face.normal.rotation_difference((0, 0, 1))

o2.matrix_world = (
    Matrix.Translation(loc_dst) @ 
    q.to_matrix().to_4x4() @ 
    scale_from_vector(scale_dst)
)
$\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.