0
$\begingroup$

When I try to do a ray_cast in object mode, I get an error “Object has no mesh data to be used for ray casting” I tried to fix it with following the steps:

bpy.context.scene.update()
context.active_object.data.update()
context.active_object.data.update(calc_edges=False)
context.active_object.update_tag(refresh={‘OBJECT’, ‘DATA’, ‘TIME’})

And even:

bpy.ops.object.mode_set(mode=‘EDIT’)
bpy.ops.object.mode_set(mode=‘OBJECT’)

Code Line 208

| improve this question | | | | |
$\endgroup$
  • $\begingroup$ I think this is a currently bug or oversight. Fails with same error in console C.object.raycast(v, d) The template operator raycast exhibits this behaviour too. (once fixed for missing dupli in 2.8) Re your script, not sure about the logic re mw.inverted() * f.normal. Suggest converting to global space, and then to local space of the object you are raycasting from. global normal $\endgroup$ – batFINGER Dec 23 '18 at 11:27
  • $\begingroup$ Thank you very much. Regarding logic, you are right, thanks! $\endgroup$ – Влад Киндюшов Dec 23 '18 at 12:42
  • $\begingroup$ unfortunately at the moment blender2.8 gives the same behaviour for the closest_point_on_mesh method. $\endgroup$ – richard Dec 31 '18 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.