I have an addon with that I draw in 3d space (lines). The vertices are where I click with the mouse cursor.
I use the region_2d_to_location to get a point from the mouse coordinates in 3d space. But I want to draw a bit more "in front" like 2 or 3 units in direction of the view camera (hope this is understandable:-))
I guess I have to manipulate the last parameter of the region_2d_to_location function, but how to calculate this location dependant on the current view?
I guess I can use the
bpy.context.space_data.region_3d.view_rotation
and then kind of multiply a vector like (2,2,2) with it to draw in a distance to the origin. Any ideas on how to do this with this Quaterion?

scalar * view_direction_vectorto result of region2d to 3d location. – batFINGER Dec 18 '18 at 09:50dirandvecas stated above are vectors.r3d.view_rotationis a quaternion. A quaternion * vector => vector. Makedira unit vectorvec -= 2 * dir.normalized(). – batFINGER Dec 18 '18 at 10:57rot = bpy.context.space_data.region_3d.view_rotation
vec = region_2d_to_location_3d(region, rv3d, (x, y), (0,0,0))
dir = rot * mathutils.Vector([0,0,-1])
error: Element-wise multiplication not supported between Quaterion and vector types
– Jayanam Dec 18 '18 at 11:40