I'm expermenting with world_to_camera_view

bpy_extras.object_utils.world_to_camera_view(scene, camera, co)

Lets say I create a new blender file. I enter every point of a cube into this function and then paint the results.

Now I do the same thing again, but this time I rotate the cube.

I expect to get different sets of points, but I get the same points.

Now lets say I add a second cube at a different position. I expect again to get a different set of points. But again I get the same points (two sets of cubes on top of each other).

If I move the camera.. then I do get different points.

So my questions are: how can I use this to see two meshes? and why do I not see changes after a cube is moved, can I turn that on somehow?

  • $\begingroup$ quick guess: You use object space coordinates. You have to multiply your coordinates with the object's world matrix to get the world space coordinates which you pass to world_to_camera_view. $\endgroup$ – pink vertex Feb 25 '14 at 9:29
  • $\begingroup$ Even though this exact question wasn't asked before, this is really the same issue here: blender.stackexchange.com/q/6155/55 $\endgroup$ – ideasman42 Feb 25 '14 at 13:47
  • $\begingroup$ Thank you this multiplying the word matrix coordinates was the exact solution. Yes I agree this is a duplicate and the answers detailed in the related question are very detailed. $\endgroup$ – user1529413 Feb 25 '14 at 23:55

Browse other questions tagged or ask your own question.