# Mathutils Vector Raycast

I have an object I wish to cast a ray from, casting using a mathutils direction vector.

The only problem is that I cannot seem to figure out how to find the 3D position (needed for the rayCast function) from the vector.

If anybody could help, I'd be terribly grateful for it. Thanks :)

• Do you wish to cast the ray from the objects origin? A specific point on the object? May 10, 2018 at 17:38
• from the origin, using the vector May 10, 2018 at 17:43
• This question blender.stackexchange.com/q/95324 and this answer should contain enough info blender.stackexchange.com/a/39678. May 10, 2018 at 17:53
• Sorry, I meant to say it's a mathutils direction vector. I know the origin of the object casting from, but need to use the direction vector to get a position in a certain direction from that origin. May 10, 2018 at 18:05
• It seems you want to measure from one point to another. What points are that? May 14, 2018 at 7:47

I know this is old but had to work on a similar situation tonight.

All you need to do is add the vector to your 3D point A(which should also be a vector pointing from your object to the origin point of the scene). This should give you a target point in 3D space.

target_point = point_A.worldPosition + vector


If you want to change the distance away from your point_A origin, you need only alter the magnitude of your vector:

vector.magnitude *= 5 # 5 times the vector length


or

vector.magnitude += 30 # 30 Blender units greater than your original vector