# How to get projection of bone-points on the plane?

Hi! Faced a problem that seems difficult to me as a beginner. Tell me please, I want to get a projection of a point from a human body model onto a plane.

And set the sphere at this point as a mark. I managed to make some progress in the task, but the coordinate transformation was too much for mу.

For making projection I suppose to use next code:

``````    loc = mathutils.geometry.intersect_ray_tri(p1, p2, p3, view_vector, view_point, True)
if not loc:
loc = mathutils.geometry.intersect_ray_tri(p2, p4, p3, view_vector, view_point, True)

``````

But how I can get the every bone coordinate?
I tried to use that code, but it doesnot work propertly:

``````pose_obj = bpy.data.objects['Reference']
hip = bpy.data.objects['Reference'].pose.bones["Body1:Hips"]

cube = bpy.data.objects['Cube'].pose

loc_hip = hip.bone.matrix_local.inverted()
``````

It often happens that as soon as you post a question on the forum, the answer comes to mind almost immediately. Probably, this is the magic of the exact wording, I don’t know. But I came across a solution that almost suits me, that is, it will probably solve the same problem. And there is very full description of blender’s different bone matrices.

Namely - how to get the world coordinates of a separate part of the skeleton, for example, the neck. And put an object in this place, for example, a cube.
I found a solution like this and ran it.

``````def matrix_world(armature_ob, bone_name):
local = armature_ob.data.bones[bone_name].matrix_local
basis = armature_ob.pose.bones[bone_name].matrix_basis

parent = armature_ob.pose.bones[bone_name].parent
if parent == None:
return  local * basis
else:
parent_local = armature_ob.data.bones[parent.name].matrix_local
return matrix_world(armature_ob, parent.name) * (parent_local.inverted() * local) * basis

import bpy

empty_ob = bpy.data.objects["Cube"]
armature_ob = bpy.data.objects["Reference"]

#bone_name = bpy.context.active_pose_bone.name
bone_name = bpy.data.objects['Reference'].pose.bones["Body1:Neck"].name

empty_ob.matrix_world = armature_ob.matrix_world * matrix_world(armature_ob, bone_name )
``````

However, it moves the test cube to the origin, not to the “neck”. Tell me, what could be the matter please? What wrong with my code?
May be someone have a time to look at Blend-file: https://drive.google.com/file/d/1Z5CfipDbISIl4KQGkVFuzt_m0cWhQJs2/view?usp=sharing
Blender has since adjusted its `mathutils` module, replacing the asterisk `*` with the at symbol `@`, aka the PEP 465 binary operator, for multiplying matrices with vectors.