0
$\begingroup$

In order to simulate a specific production process in Blender I need to ensure that the scene's gravity "down" is aligned with the viewport's angle.

In other words in this case:

enter image description here

"Down" should be along the x-axis, like this:

enter image description here

I know I can get the view matrix and decompose it like this:

t, r, s =  bpy.context.space_data.region_3d.view_matrix.decompose()

and I can get/set the scene's gravity like with

bpy.context.scene.gravity

How do I combine the two so that things always fall "from" the viewpoint and "towards" the point being looked at?

$\endgroup$
7
  • $\begingroup$ It sounds like you want top view. Numpad 7 gives you top view and numpad 5 toggles between orthographic and perspective. If you do want to manipulate the viewport viewpoint see this answer $\endgroup$ Nov 15, 2021 at 22:17
  • $\begingroup$ @MartyFouts - thanks, but actually, no: I want to simulate the process of glueing of a patch onto a curvy surface withminimal distortion: this process would not always happen along the Z axis $\endgroup$
    – simone
    Nov 16, 2021 at 6:10
  • $\begingroup$ Did you see the answer I posted the pointer to? It shows how to do the combining. Isn't that what you want? $\endgroup$ Nov 16, 2021 at 14:41
  • $\begingroup$ Yes, I did. Maybe it’s me but I don’t get the connection - apart from getting the rotation matrix. Should I brush up on matrices and vectors instead of asking questions? $\endgroup$
    – simone
    Nov 16, 2021 at 18:13
  • $\begingroup$ I can't know what do and don't already know, so I have to ask when things I thought might help didn't so I can figure out how to help. I also have to ask questions to make sure I understand what you really want. $\endgroup$ Nov 16, 2021 at 18:33

0

You must log in to answer this question.

Browse other questions tagged .