I see in Blender 2.81 that cursor has rotation informations. I would like to find a way to use cursor's Orientation and apply it to an object. Is there an easy way to do that ?
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It only takes a minute to sign up.Sign up to join this community
Snap to cursor with code
Quick little script to copy either or both of cursor location, rotation to selected objects.
import bpy from mathutils import Matrix use_rotation = True # use cursor rot use_location = True # " " loc context = bpy.context cursor = context.scene.cursor tc, qc, sc = cursor.matrix.decompose() for ob in context.selected_objects: to, qo, so = ob.matrix_world.decompose() R = qc.to_matrix().to_4x4() if use_rotation else qo.to_matrix().to_4x4() T = Matrix.Translation(tc) if use_location else Matrix.Translation(to) S = Matrix.Diagonal(so).to_4x4() ob.matrix_world = T @ R @ S