Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Problem with ScreenToWorld Conversion

    SDK Help
    0
    7
    1.3k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 12/11/2002 at 10:11, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   8.012 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Hi,
      When using the GeRayCollider Library and I determine a Ray->Edge Detection I am using the current Mouse Position that I got from the &msg BaseContainer in the Mouse Input Method and Convert the Screen Coords into World Coords. But it seems I am doing something wrong, because when I rotate the editor view the point I have set is actually not on my edge but anywhere in the space.
      Col = bd->SW(Vector(mx,my,0));
      is what I am using to convert the point to world space.
      Any idea why it is wrong?
      thanks

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 12/11/2002 at 10:14, xxxxxxxx wrote:

        I guess I got it. Now I´m using the distance instead of 0 for Col.z.
        but if somebody has a better idea? I´m open. 🙂

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 12/11/2002 at 10:44, xxxxxxxx wrote:

          Hmm, it is still not exact enough 😕 Does anybody know how to get the exact ScreenToWorld conversion?
          Thanks in advance

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 12/11/2002 at 11:40, xxxxxxxx wrote:

            Could you define what you mean by "ScreenToWorld conversion" and describe how BaseView::SW() fails to be exact by this definition?

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 12/11/2002 at 12:30, xxxxxxxx wrote:

              The problem is that when I am near an edge with the mouse pointer in screen space, then the barycentric coords get close to 0.0. Ok so I am checking if they are smaller than 0.02. If so I store the position of the mouse pointer in i.e. Col = bd->SW(Vector(mx,my,res.distance));
              Looking into the editor view I can see that the XORLine is drawn (the way I want it) on the edge. But when I rotate the view I can actually see that the XORLine (or rather the World Coordinates that I got from the conversion) is not drawn on the edge but under the edge or beside it or or or. And it´s not close enough to the edge! That is the problem. If the barrycoords are so close and I am right over the edge with the mouse, why is the world position after conversion not on the edge or at least pretty close to it? With these Coords of Col I can´t do nothing. They are not exact enough. D
              That is my problem. Any ideas?
              Thanks Samir

              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 12/11/2002 at 14:01, xxxxxxxx wrote:

                Quote: Originally posted by 3D Designer on 12  November 2002
                >
                > * * *
                >
                > Col = bd->SW(Vector(mx,my,res.distance));
                Use the real position instead: "obj->GetMg() * res.hitpos".

                1 Reply Last reply Reply Quote 0
                • H
                  Helper
                  last edited by

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 13/11/2002 at 00:24, xxxxxxxx wrote:

                  Oh my god, why didn´t that come to MY mind? You´re the man!
                  Thanks very much Mikael. You saved my a.... further developement. 😉
                  Best
                  Samir

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post