ScreenToWorld Oddness

    Feb 27 2013 | 2:49 am
    The Screentoworld message to gives me results which I cannot figure out. This is the first time I have tried to use these commands, and I can't figure out what they are supposed to do.
    In my case, I would like to map 3d objects to positions on a plane. The positions of these objects should correspond to tracked aspects of the video which is the texture of the plane. I can do this by writing code to which I supply the dimensions of the video, the aspects of the 3d world, etc. but I was under the impression that I could use "screentoworld" for the same functionality. There must be a fundamental difference between what I expect and what is happening.
    In the attatched MaxPat, I am simply trying to understand the relationship between the values I feed to the "screentoworld" message and the values I receive from the object. What I expect is that if I give a screen coordinate of x=0, I should get a value representing the leftmost edge of the visible gl world. Instead, x=0 gives me -0.055228. If I then put this value into "worldtoscreen", I get 152 back.
    What "screen" is being considered, and what "world"?
    Thanks in advance!

    • Feb 27 2013 | 8:26 pm
      hi lembert.dome. take a look at the following patch. if this doesn't clear things up, please let me know what is not clear.
    • Feb 27 2013 | 10:37 pm
      Ah! Thank you! The difficulties I experienced were simply that I did not know the context. One important point: it is important to set the screenToWorld Z-position relative to the WorldToScreen Z-position after changing render-camera position.
      What I am working on is akin to this patch:
      ` The thing which made it work for me is to scale the video resolution to the x and y scale of the vidplane, and set the Z-position the same on vidplane and intersecting gridshape.
      Next, I want to figure out an elegant way of doing the transform on the screen to world (my subpatcher) so the red sphere can follow rotations of the vidplane. Any hints?
      Thanks again!