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

    check obj in out other object

    Scheduled Pinned Locked Moved PYTHON Development
    6 Posts 0 Posters 478 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 26/08/2016 at 02:52, xxxxxxxx wrote:

      Hello to all!  
        
      How can I do a check with python to see if an object is inside another object area?  
      I have a piramid and i want to know if an object is in or out!  
        
      Cheers :slightly_smiling_face::slightly_smiling_face::slightly_smiling_face:  
      
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 29/08/2016 at 02:48, xxxxxxxx wrote:

        Hello Davide,

        the complexity of this task depends highly on the precision you need.
        The easiest would probably be a comparison based on bounding boxes, check GetMp() and GetRad() for this.

        But if you are looking for a precise solution based on volumes or actual shapes and will get arbitrarily complex. You'll almost certainly want to look into the GeRayCollider module. The SDK Team can't provide algorithms, so this will be a matter to be discussed within the community.

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

          On 29/08/2016 at 10:05, xxxxxxxx wrote:

          Hello Andrea, tnx for reply
           At the moment i resolve this problem with the GeRayCollider but i use xpresso becouse i find problem with him in python 😢😢😢

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

            On 29/08/2016 at 10:08, xxxxxxxx wrote:

            Can you provide us some details on the problems you have with GeRayCollider?
            A code snippet to reproduce the problem would be even better.

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

              On 29/08/2016 at 10:15, xxxxxxxx wrote:

              This is my code (another code but same problem) :

              import c4d
              from c4d import *
              from c4d.utils import GeRayCollider
              from c4d.modules import mograph as mo
              import math
              #Welcome to the world of Python

              def main() :
                Obj = op[c4d.ID_USERDATA,1]

              ObjPos= Obj.GetMg()

              mg = gen.GetMg()

              md = mo.GeGetMoData(op)
                if md is None: return False
               
                cnt = md.GetCount()
                marr = md.GetArray(c4d.MODATA_MATRIX)
                fall = md.GetFalloffs()
                for i in reversed(xrange(0, cnt)) :
                    Ray=GeRayCollider()
                    Ray.Init(Obj)
                    Ray.Intersect(marr _.off,ObjPos.off,300000)
                    print Ray.GetIntersection(0)

              md.SetArray(c4d.MODATA_MATRIX, marr, True)
                return True

              I understand the problem form me is to find the "object coordinates, this is not the abs and the rel coordinate, i need to understand the concept

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

                On 31/08/2016 at 11:24, xxxxxxxx wrote:

                Hi Davide,

                sorry for the delay.
                There's an article on matrix fundamentals in the Python documentation that may be helpful.
                I'm sorry, if it may seem obvious to you, but can you please describe your actual problem? I guess the code you posted is supposed to be used in a MoGraph Python Generator? How am I supposed to use it? And what's the supposed outcome? So, what do you want to achieve (expected or correct result) and what happens instead?

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