I painted a circle into the viewport with Python, the circle has a center Vector (self._center) in world space.

enter image description here

I want to move the center vertex to the local x location 0.

So I tried to convert the self._center first to local values by using the view matrix that I stored and set X to 0:

vm = self._view_context._view_mat
v = self._center.copy()
v = v @ vm
v[0] = 0

Now I want to set the self._center to the new value (v) but in world space. Does anybody know how to revert it back to world space?


1 Answer 1


Guess I solved it like this:

rot_mat = self._view_context._view_mat

v = rot_mat @ self._center
v2 = rot_mat.inverted() @ Vector((-v[0],0,0))

self._center += v2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .