Skip to main content
Tweeted twitter.com/StackBlender/status/1195265348871831552
added 476 characters in body
Source Link
bortran
  • 1.4k
  • 1
  • 14
  • 27

Read through a lot of questions but I didn't find a simple answer.

How do I move an object on it's local axis using a vector? I don't want to use bpy.ops.transform.translate, because it's slow.

Given an object that is rotated and an example vector (1,2,3). How can I do a translation on the local axis, so the object is moved 1 on it's local x-axis, 2 on the local y-axis, 3 on the local z-axis. Just like in the viewport, when you move an object pressing "g" and then pressing the x-axis key (or y / z) twice.

EDIT: So from a C++ post I understand the math behind it, still I'm unable to reproduce it in Blender. For the local translation T you have to do the translation first, then multiply it with the rotation matrix R. So (pseudocode)

myobject.location = T(1,2,3) * R

Problems: 1.) How do I get R of the object that is already rotated. 2.) Can I just multiply a vector with that matrix? 3.) What about the location that the object had before? Just add it?

Read through a lot of questions but I didn't find a simple answer.

How do I move an object on it's local axis using a vector? I don't want to use bpy.ops.transform.translate, because it's slow.

Given an object that is rotated and an example vector (1,2,3). How can I do a translation on the local axis, so the object is moved 1 on it's local x-axis, 2 on the local y-axis, 3 on the local z-axis. Just like in the viewport, when you move an object pressing "g" and then pressing the x-axis key (or y / z) twice.

Read through a lot of questions but I didn't find a simple answer.

How do I move an object on it's local axis using a vector? I don't want to use bpy.ops.transform.translate, because it's slow.

Given an object that is rotated and an example vector (1,2,3). How can I do a translation on the local axis, so the object is moved 1 on it's local x-axis, 2 on the local y-axis, 3 on the local z-axis. Just like in the viewport, when you move an object pressing "g" and then pressing the x-axis key (or y / z) twice.

EDIT: So from a C++ post I understand the math behind it, still I'm unable to reproduce it in Blender. For the local translation T you have to do the translation first, then multiply it with the rotation matrix R. So (pseudocode)

myobject.location = T(1,2,3) * R

Problems: 1.) How do I get R of the object that is already rotated. 2.) Can I just multiply a vector with that matrix? 3.) What about the location that the object had before? Just add it?

Source Link
bortran
  • 1.4k
  • 1
  • 14
  • 27

Python move object on local axis

Read through a lot of questions but I didn't find a simple answer.

How do I move an object on it's local axis using a vector? I don't want to use bpy.ops.transform.translate, because it's slow.

Given an object that is rotated and an example vector (1,2,3). How can I do a translation on the local axis, so the object is moved 1 on it's local x-axis, 2 on the local y-axis, 3 on the local z-axis. Just like in the viewport, when you move an object pressing "g" and then pressing the x-axis key (or y / z) twice.