Guest User

Untitled

a guest
Oct 17th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. # decompose world_matrix's components
  2. orig_loc, orig_rot, orig_scale = obj.matrix_world.decompose()
  3. #create the translation vector
  4. translation = mathutils.Vector((2,1,-1))
  5. new_loc = orig_loc + translation
  6. orig_loc_mat = Matrix.Translation(new_loc)
  7. orig_rot_mat = orig_rot.to_matrix().to_4x4()
  8. orig_scale_mat = Matrix.Scale(orig_scale[0],4,(sqrt(2),0,0)) *
  9. Matrix.Scale(orig_scale[1],4,(0,1,0)) *
  10. Matrix.Scale(orig_scale[2],4(0,0,sqrt(2)))
  11.  
  12. obj.matrix_world = orig_loc_mat * rot_mat * orig_rot_mat *
  13. orig_scale_mat
Add Comment
Please, Sign In to add comment