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
    • Recent
    • Tags
    • Users
    • Login

    GeRayCollider work only in Perspective view?

    Scheduled Pinned Locked Moved PYTHON Development
    2 Posts 0 Posters 126 Views
    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 Offline
      Helper
      last edited by

      On 08/05/2014 at 10:19, xxxxxxxx wrote:

      Hi! 
      As title... 
      for views Top...

      cam_pos = bd.GetSceneCamera(doc).GetAbsPos()

      is not recognized....

      cursorpos = bd.SW(c4d.Vector(mx,my,500))

      collider = c4d.utils.GeRayCollider()
      collider.Init(mypoly)
      length = 500000
      direction = -(cam_pos - cursorpos).GetNormalized()
      did_intersect = collider.Intersect(cam_pos, direction, length)

      if did_intersect:
      position = collider.GetNearestIntersection()["hitpos"]

      else:
      position = cursorpos

      doc.AddUndo(c4d.UNDOTYPE_CHANGE, myobject)
      myobject.SetAbsPos(position)

      where I am wrong?

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

        On 08/05/2014 at 12:19, xxxxxxxx wrote:

        Hi,

        It works...
        But be aware if you change to e.g. Top view, your

        cam_pos = bd.GetSceneCamera(doc).GetAbsPos()

        is c4d.Vector(0,0,0)

        Martin

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