0
$\begingroup$

So I have the following situation:

I have 2 objects: object A has no rotation(Since the rotation has been applied via ctrl-a) and object B has a random rotation. Now I want to make object A have the same rotation as Object B. My guess is that I somehow have to get the obj B rotation as a vector and then aim obj A in that direction. The thing is that I have to have the exact same rotation as obj B has. (If the rot of obj B is greater than 360, then obj A rot doesn’t have to be greater than 360, it should just aim in the same direction and the roll/yaw/pitch should be exactly the same. So how can I achieve this via Python?

$\endgroup$
2
$\begingroup$

If you just want to copy the rotation values, there is "Copy Rotation" in the Constraints tab, no need for Python scripts. If you need it for a Python script, objects have rotation_euler, rotation_quaternion, and rotation_axis_angle attributes, and rotation_mode for selecting one of them.

$\endgroup$
  • $\begingroup$ There is also rotation_axis_angle and rotation_mode is used to determine which rotation value is used. $\endgroup$ – sambler Dec 29 '15 at 11:05
  • $\begingroup$ @sambler For some reason I have seen those during testing and quickly ignored them thinking that they are unimportant. That was a silly thing to do. Thank you for the additional information. $\endgroup$ – HalfKiloByte Dec 29 '15 at 11:33

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.